问题
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+"¶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
来源:https://stackoverflow.com/questions/3052647/pass-value-to-another-jsp