jsp向action传值

kln78 2008-06-18 05:34:27
pageAdd.action:
String edit=null;

edit=request.getParameter("edit");

//如果从pagetest.jsp页转过来且点新增,就转向填加页add.jsp
if(edit.equals("new")){
edit="add";
request.setAttribute("edit", edit);
return mapping.findForward("success");
}
add.jsp
<html:html locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<bean:define id="tempid" name="edit" type="java.lang.String"/>
<html:form action="/pageAdd.do?edit=<%=tempid%>">
名称:<html:text property="title"></html:text>
内容:<html:text property="content"></html:text>
<html:submit>submit</html:submit>
</html:form>
</body>
</html:html>
问题:tempid为空
...全文
244 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kln78 2008-06-19
  • 打赏
  • 举报
回复
用 <%=request.getAttribute("tempid")%>
出现/add.jsp(14,69) equal symbol expected错误
kln78 2008-06-19
  • 打赏
  • 举报
回复
谢谢提醒
已经结了
kln78 2008-06-19
  • 打赏
  • 举报
回复
在本页能读到值
new_bird_0001 :<bean:write property="tempid"/>
不是得在form里写tempid属性,我不想这么做
new_bird_0001 2008-06-18
  • 打赏
  • 举报
回复
<bean:write property="tempid"/>或<%=request.getAttribute("tempid")%>
sunshinewhile 2008-06-18
  • 打赏
  • 举报
回复
先看看能不能在本页取行tempid的值

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧