Pass value to another jsp
I have come in a situation where I need to create开发者_StackOverflow中文版 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....
I'm not familiar with struts, but won't this do the trick?
<td><a href="#" onclick="javascript:openWindow(<%=current.getProductId()%>)">Click
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.
How about this?...
<javascript>
var hasEditRightsJSProp = <s:property value="#hasEditRights" default="false" />;
function openWindow() {
window.open(url+"¶m1="+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
精彩评论