社区
Java EE
帖子详情
struts 中 html:select 如何提交多个已选option项
绿皮车
2003-09-08 04:17:36
请教一下:
struts中 如何将 html:select 列表中多选的option项提交到一个action中处理,如何实现?
多谢!
...全文
188
4
打赏
收藏
struts 中 html:select 如何提交多个已选option项
请教一下: struts中 如何将 html:select 列表中多选的option项提交到一个action中处理,如何实现? 多谢!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
绿皮车
2003-09-08
打赏
举报
回复
基本搞定了,不过可以看看jdon上面的一篇关于html:options的文章,我想知道如果struts页面中一个html:form 嵌套另一个html:form可不可以,像下面这样:
<tr bgcolor="#C8DAEC">
<td>
<bean:define id="services" name="servicecatalogForm"/>
<html:select property="leftselectedvalue" multiple="multiple">
<html:options collection="services"
property="unselservicesvalue"
labelProperty="unselserviceslabel"/>
</html:select>
</td>
<html:form name="ServiceLocationForm" action="ServiceLocationAction.do" >
<td> <html:button value="增加 " property="addservice" />
<br> <html:button value="删除 " property="delservice" />
<html:submit value="配置服务" property="Configuration" />
<html:reset value="重 置" property="Reset"/>
</td>
<td>
<bean:define id="services" name="servicecatalogForm"/>
<html:select multiple="multiple" property="selservicesvalue" size="8">
<html:option value="">选择以下类别</html:option>
<html:options collection="services" property="pastservicesvalue" labelProperty="pastservcieslabel" />
</html:select>
</td>
</html:form>
</tr>
页面中最初两列表值从servicecatalogForm中得到,当点“增加”/“删除”按钮时,左侧服务被选中项目会移到右侧并减少,右侧列表自动增加该服务/或反之,这里我拿不准,是通过javascript实现,还是提交到action中去实现,最后点击“配置服务”将整个页面提交到ServiceLocationAction中处理
mem_fox
2003-09-08
打赏
举报
回复
1楼的正解,如果你问Form怎么设,当然就是用String[]作参数的类型啦
绿皮车
2003-09-08
打赏
举报
回复
在struts 架构中,具体如何?
CeleronII
2003-09-08
打赏
举报
回复
<select name='sel' mutiple=true>
...
</select>
直接提交到后台,返回一个字符数组
struts
2实现页面
select
标签默认选
中
假设我们需要根据用户
提交
的`auditingLog`对象
中
的`auditingState`属性值来决定`<
select
>`
中
的哪一
项
被默认选
中
,可以通过以下方式实现: ```xml <s:
select
name="auditingLog.auditingState" list="{'1','0'}" ...
struts
操作
select
标签实例
在
Struts
中
,`
html
:
select
`标签是用于创建
HTML
下拉列表的一个重要元素,特别适用于用户界面
中
需要选择单一或
多个
选
项
的场景。本文将深入探讨`
html
:
select
`标签的使用方法及其相关知识点。 首先,我们需要理解`...
struts
1.x
html
标签 radio,checkbox,multibox,
select
的使用
在
HTML
中
,单选按钮通常用`<input type="radio">`表示,但在
Struts
1.x
中
,`
html
:radio`提供了更便捷的方式来绑定后台的ActionForm属性。通过设置`property`属性,可以将选定的值与ActionForm
中
的某个字段关联。如果...
JSP_
Struts
标签
html
:
select
option
基本用法
<
html
:
select
>,<
html
:
option
>...
html
:
option
s&...
html
:
option
sCollection&...
select
>元素 <
html
:
option
>:生成
HTML
<
option
>元素 &
struts
中
使用多选的
html
:
select
在
Struts
中
使用多选的
select
时,应该做如下设置: 1. jsp页面
中
要在
select
元素
中
加入multiple="true"选
项
; 2. ActionForm
中
应将改参数设置成String[]类型; 3. Action
中
应该遍历String数组,进行所需的业务...
Java EE
67,549
社区成员
225,860
社区内容
发帖
与我相关
我的任务
Java EE
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
复制链接
扫一扫
分享
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章