日期:2014-05-20  浏览次数:20576 次

关于JSP中的一点小问题~~~~~~
就是在页面里除了使用 <input   type=submit> 来实现页面的跳转,还在同一   表单里做一个和 <input   type=submit> 外型一样的按健,和
<input   type=submit> 不同的是前者是跳转到 <form   action=xxx.jsp> 中的
xxx.jsp页面,而后者是跳转到其他自定义的页面!就有点像
〈input   type=button〉!
但我不想用〈input   type=button〉靠使用JAVASCRIPT来实现,请问还有其他办法吗?

就是在同一表单里有两个按钮,点击后会跳到不同页面~因为是在用的STRUCTS所以不想用〈A> 和JAVASCRIPT来实现这种功能,请问还有其他方法吗?

------解决方案--------------------
没有写过,你这样试试:
<input type= 'submit ' value= '按钮1 ' onclick= 'document.getElementById( "form ").action=a.jsp '>
<input type= 'submit ' value= '按钮2 ' onclick= 'document.getElementById( "form ").action=b.jsp '>
------解决方案--------------------
<input type=submit onclick= "window.open( 'b.jsp ') ">
不过会打开新窗口。。。
------解决方案--------------------
可以考虑使用stuts的标签, <html:link page= "/taget.do " > <input type=button> </html:link>
不过实际上跟连接的原理是一样的。
------解决方案--------------------
STRUTS本身就有这样的功能!
------解决方案--------------------
<form id= "form1 " action= "1.jsp ">
<input type= "submit "/> <input type= "submit " onclick= "document.getElementById( 'form1 ').action= '2.jsp ' "/>
</form>

------解决方案--------------------
不太明白?有搞头么?

一个按钮对应一个action,两个当然是两个action了,一个action对应一个forward,很简单的实现。这样的问题有意思么?
------解决方案--------------------
可以这样写
<input type= "button " onclick= "onclick1() " value= "查询1 "/> </td>
<input type= "button " onclick= "onclick2() " value= "查询2 "/> </td>
javascript 中这样写:
function onCheckInfo(){
document.all.SelectForm.action= '1.jsp '
}
function onCheckInfo(){
document.all.SelectForm.action= '2.jsp '
}