JiveJdon Community Forums
在线234人   首页   主题表   培训咨询   标签   精华   查搜   注册    登陆 RSS
首页 » 论坛 » 开源项目大家谈
???en_US.forumThreadPrev.name??? 上一主题
google yahoo 365Key网摘 CSDN网摘 添加到百度搜藏 POCO网摘 新浪ViVi 天极网摘
???en_US.forumThreadNext.name??? 下一主题
Go 共有 1 回复 / 1
 发表新帖子   回复该主题贴
vitofh

悄悄话
发表文章: 1
注册时间: 2007年04月24日 13:38
struts的复选框html:multibox的问题 2007年04月24日 13:40 到本帖网址 加入本帖到收藏夹 回复该主题
标签
为什么在页面上html:multibox的取值数组的长度为0;
JSP页面:
Vector vecPart=(Vector)session.getAttribute("partList");
TopicDisp partList=null;
if(vecPart!=null)
{
for(int i=0;i<vecPart.size();i++)
{
partList=(TopicDisp)vecPart.get(i);
%>
<tr bgcolor="#CCFFFF">
<td>
<html:multibox property="selectBox"><%=partList.getId()%></html:multibox><%=partList.getId()%>
</td>
<td><%=partList.getId()%></td>
<td><%=partList.getTitle()%></td>
<td><%=partList.getContent()%></td>
</tr>
<%
}
}

FORM页面:
private String[] selectBox=new String[0];

public String[] getSelectBox()
{
return selectBox;
}

public void setSelectBox(String[] selectBox)
{
this.selectBox = selectBox;
}

public void reset(ActionMapping mapping,HttpServletRequest request)
{
this.selectBox=new String[0];
}

ACTION部分为:
SaveRecrodForm sForm=new SaveRecrodForm();
String[] sId=sForm.getSelectBox();

System.out.println("sId.length="+sId.length);
for(int i=0;i<sId.length;i++)
System.out.println(sId);
banq

悄悄话
发表文章: 9613
注册时间: 2002年08月03日 17:08
回复:struts的复选框html:multibox的问题 2007年04月24日 17:53 到本帖网址 加入本帖到收藏夹 回复该主题
<html:multibox property="selectBox"><%=partList.getId()%></html:multibox><%=partList.getId()%>

必须全部使用Struts标签,不要自己加入Java语句,ActionForm中需要两个值:一个是多个字符串,一个是multibox选中的缺省值。
标签
共有 1 回复 / 1Go
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表    返回页首返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG:
正在读取,请等待...
查询本论坛内 回复超过的热门帖子
标题
 
粗体: [b]文本[/b] 斜体: [i]文本[/i] 下划线 [u]文本[/u] 插入图片 [img]http://wwww.xxxx.com/img.ext[/img] 插入代码 [code]程序代码[/code]  插入url链接 [url]http://url[/url] / [url=http://url]URL加下滑线[/url] 插入附件 插入word文档 Txt等文件
内容
  提交时自动拷贝以上内容到剪贴板 Ctrl-V可取出;提问题前先查询标签列表

RSS 手机阅读 add to google add to yahoo
解惑之道在J道 ,打造中国最具影响力的的企业软件社区 推荐Chrome快速浏览本站
OpenSource JIVEJDON v3.5 Powered by JdonFramework Code © 2002-09 jdon.com

anti spam