Pass value to another jsp

六月ゝ 毕业季﹏ 提交于 2020-01-06 02:46:05

问题


I have come in a situation where I need to create a hiperlink for each entry in collection following is my code..

       <td><a href="#" onclick="javascript:openWindow(--------)">Click 

How can i get ${current.product_id} value in blank space... so that i can pass my value to next jsp for internal processing....


回答1:


I'm not familiar with struts, but won't this do the trick?

<td><a href="#" onclick="javascript:openWindow(<%=current.getProductId()%>)">Click



回答2:


Try this i have given sample code

<%
String str = "/details.do?method=showQuestions&surveyId="+arrayNew.get(0);
%>

<html:link page='<%=str%>'><%=arrayNew.get(1)%></html:link><br>

In action class under showQuestion method you can get the value of surveyId by using simple String str = request.getParameter("surveyId");

Read url rewritting topic for more details.




回答3:


How about this?...

<javascript>
  var hasEditRightsJSProp = <s:property value="#hasEditRights" default="false" />;
  function openWindow() {
    window.open(url+"&param1="+hasEditRightsJSProp,'name','height=200,width=150'); 
  }
<javascript>
<td><a href="#" onclick="javascript:openWindow()</td>

I dont like programs that open popups, but if you reall do and you want to pass parameter over the URL then see the code above.

Hope that helps Jeff Porter



来源:https://stackoverflow.com/questions/3052647/pass-value-to-another-jsp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!