i want to send more than one parameter to servlet through anchor tag .
but the problem is one parameter is the return value of java script method .
For more Explanation ;
<% int cnt = 1;%>
<c:forEach items="${requestScope.AllUsers}" var="user">
<tr id="<%=cnt%>">
<td >${user.userName}</td>
<td>${user.emailAddress}</td>
<td><a onclick="return getUserName(<%=cnt%>)" href="servlet?">modify</a></td>
</tr>
<%cnt++;%>
</c:forEach>
// here i want to use the return value returned form getUserName (java script method) and another parameter (it’s name is page) and send it to servlet when click on modify hyberlink
how can i make that?
The return value in your
onclickhandler doesn’t do what you expect it to do.onclicksimply expects a true or false return value and cancels link navigation if you return false. Instead, you want to send the user to the URL you want directly from theonclickhandler. Try something like this: