struts的问题

wolililaile 2009-12-31 07:28:52

<html:form action="/list?commpar=select" method="post">
类别:<html:select property="commodity.comtype">
<html:optionsCollection name="comType" label="typeName" value="typeId"/>
</html:select>
品牌:<html:select property="commodity.brand">
<html:optionsCollection name="brands" label="brandName" value="brandId"/>
</html:select>

<html:submit value="查找"/> <html:submit value="增加"/>
</html:form>


这里的问题是如何使 commpar 参数随着你提交 查找" 或 "增加" 而执行 在 DispatchAction 不同的方法

我知道用form加上js可以 可<html:form > 如何用,
而且
<html:select property="commodity.comtype">
<html:optionsCollection name="comType" label="typeName" value="typeId"/>
</html:select>

是不是一定要放html:form >里面 我放 <form>中就出错

我的配置文件

<action-mappings>
<action path="/list" parameter="commpar" input="/index.jsp" type="com.y2b2.Action.CommodityAction" name="CommodityForm" scope="session">
<forward name="list" path="/list.jsp" ></forward>
</action>
</action-mappings>

这个parameter 它能填入什么参数 我现在只知道一种 就是跟在<html:form action="/list?commpar=select" method="post"> 后面
...全文
122 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiangaijava 2010-01-01
  • 打赏
  • 举报
回复
类别: <html:select property="commodity.comtype">
<html:optionsCollection name="comType" label="typeName" value="typeId"/>
</html:select>
改为:
类别: <html:select property="commodity.comtype">
<html:optionsCollection name="commodity.comType" label="typeName" value="typeId"/>
</html:select>

品牌: <html:select property="commodity.brand">
<html:optionsCollection name="brands" label="brandName" value="brandId"/>
</html:select>
改为:
品牌: <html:select property="commodity.brand">
<html:optionsCollection name="commodity.brands" label="brandName" value="brandId"/>
</html:select>
应该就可以了,我就是这么做的。
爱在音乐 2010-01-01
  • 打赏
  • 举报
回复
你可以在<html:form action="login.do?param=login" method="post"></html:form>
这里param的值login是action中的一个方法,方法的参数和execute方法的参数是一样的,想实现调用仅仅在struts-config.xml配置文件中在<action>标签中设置method参数即可,如:
<action name="..." path="/login" method="param" class="...LoginAction"></action>
wolililaile 2009-12-31
  • 打赏
  • 举报
回复
有struts1.2的高手帮帮忙吗
wolililaile 2009-12-31
  • 打赏
  • 举报
回复
来人啊
crazylaa 2009-12-31
  • 打赏
  • 举报
回复
只知道不一定要放html:form。
帮顶

81,090

社区成员

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

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