日期:2014-05-18  浏览次数:20711 次

按钮与跳转的问题?
比如在一个Jsp页面中,我有新建,编辑两个按钮,我现在要根据这两个按钮的值(是name值还是value呢),来跳转页面应该怎么做能(在struts框架中)。

------解决方案--------------------
<form>
<input type= "hidden " name= "optype " value= " " />
<input type= "button " value= "新建 " onclick= "this.form.optype.value= '新建 ';this.form.submit() " />
<input type= "button " value= "编辑 " onclick= "this.form.optype.value= '编辑 ';this.form.submit() " />
<input type= "button " value= "删除 " onclick= "this.form.optype.value= '删除 ';this.form.submit() " />
</form>

根据optype的值即可
------解决方案--------------------
request.getParameter( "optype ")
如果用的struts
用form对象里面对应的get方法
------解决方案--------------------

request.getParameter( "optype "),根据取的值进行相对应的跳转
------解决方案--------------------
我比较白,建议LZ重新描述下问题,才好回答。


如果象前面几个说的方法,就要在form里面设置好对应name的字段的set()和get()。

那样递交的时候,value会set进去。action中可以从form里面get出来

------解决方案--------------------
<form name= "form1 " action= " <% if request.getParameter( "optype ") out.print( "1.jsp "); else out.print( "2.jsp ");%> ">