struts的提交参数传递及显示多条记录的问题, 谢谢!

fangss 2003-05-30 03:06:21
问题一:
我的form都要提交的一个man.do但传递的参数不同.
如add时, action="/man.do?para=add"
delete时,action="/man.do?para=delete"
我用javacript不对呀.
<html:form name="form1" action="/man.do">
<input type=hidden name="para" value="" />
<input type="button" value="Add Task" onClick="onAdd()" />
<input type="button" value="Delete Task" onClick="onDelete()" />
</html:form>

<script language="javascript">
function onAdd(){
document.form[0].action="/man.do?para=add";
document.form[0].submit();
}
</script>

报错:avax.servlet.jsp.JspException: Must specify type attribute if name is specified.

这种情况该如何处理?

问题二:
如果页面显示多条记录如何做呀?是要form的数组嘛?越详细越好.
...全文
94 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ukyer 2003-05-30
  • 打赏
  • 举报
回复
2,可以将记录集 put hashmap or ArrayList

<bean:define id="list" name="item" property="value" type="ArrayList"/>
定义arraylist
<bean:define id="item" name="beanId" property="hashmapInBean" type="ExpandHashMap"/>
定义一个hashmap
<bean:write name="item" property="value"/>输出
当然,要用到logic:iterate中

ukyer 2003-05-30
  • 打赏
  • 举报
回复
1.<script language="javascript">
var actionFlag = "";//action动作标志
function onAdd(){
actionFlag = "add";
document.form[0].action="/man.do?para=add";
document.form[0].submit();
}
function onDelete(){
actionFlag = "delete";
document.form[0].action="/man.do?para=add";
document.form[0].submit();
}
</script>
jsp中
<logic:equal name = "FormBean" property="actionFlag"value="add or delete">
</logic:equal>
fangss 2003-05-30
  • 打赏
  • 举报
回复
能解释一下吗?初学哎
尤其是第一个.谢谢拉
signboy 2003-05-30
  • 打赏
  • 举报
回复
1.
<html:form name="form1" action="/man.do">
<input type=hidden name="para" value="" />
<input type="button" value="Add Task" onClick="onAdd()" />
<input type="button" value="Delete Task" onClick="onDelete()" />
<input type="hidden" name =para value="Delete" />

</html:form>

2.
<table width="50%" border="0" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr><td>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr class="titlerow">
<th> 工作流名称</th>
<th> 说明</th>
<th width="40"> 选定</th>
<th width="40"> 编辑</th>
</tr>
<%
int num = 0;
String bgColor = null;
%>
<logic:iterate id="flow" type="justnorth.common.Flow"
name="<%= Constants.ROLE_ARRAY_KEY %>">


<tr >
<td><a href="flowdetail.do?action=list&flowID=<bean:write name="flow" property="flowID"/>"> <bean:write name="flow" property="flowName"/></a></td>
<td> <bean:write name="flow" property="remark" filter="true"/></td>
<td width="25" align="center"><input type="checkbox" name="checkbox<%= num %>" value="<bean:write name="flow" property="flowID" filter="true"/>"></td>
<td> 
<a href='javascript: void(0)' onClick='add(<bean:write name="flow" property="flowID" filter="true"/>)'>
<img src="images/edit.gif" width="14" height="15" border="0">
</a>
</td>
</tr>
</logic:iterate>
</table>

81,115

社区成员

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

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