Giacomo Boschele Giacomo Boschele - 1 year ago 45
HTML Question

Link that forwards a page with params jsp

I'm building a website for a school project. In a page i need a link to another page (profile.jsp) with params, because I need to do a query in that page. I've tried forward in

but it opens the page right away, I need to activate this with a link, or also with a button. Here I'm using windows.location but it doesn't allow me to give params as far as i now.

<div class="mask_container">
<p onClick="JavaScript:window.location='profile.jsp';"><%out.println(autor);%></p>
<img src="img/like-white.png" class="social">
<img src="img/comment-white.png" class="social">
<img src="img/download-white.png" class="social">

Answer Source

how about passing your parameter values in query string as shown below, instead of <p> tag put below <a> tag to redirect to another page

<a href="profile.jsp?param=<%out.println(autor);%>&otherparam=<%out.println(otherparameter);%>"><%out.println(autor);%></a>  

You can get value of parameter on other page using request.getParameter("param") this will gives you parameter value.

May this will help you.