Question

i want to use JSP values in servlet. iam fetching some parameters from the url and i need to pass those parameters in my servlet and also the servlet result something by using those parameters and i want to use the result again in the same jsp and in other jsp. i get those parameters first time when my home jsp is called. i am getting url parameter by using jstl core tags:

<c:set var="data" scope="session" value="${param.urldata}" /> 

How do i do this using JSP tags??? Thanks in advance

Was it helpful?

Solution

As i understand somewhat , you are trying to send the values from JSP page to Servlet..

For this we have lot of solution

  • Pass the value through method
  • Set the value at session and get it wherever you want in the whole application

I prefer second point, because which hold the value for the entire application

Check Pass variables from servlet to jsp

Above question pass the value from servlet to JSP,Your question is opposite of the answer that's it..!

Set value at JSP : session.setAttribute("key","value");

Get value at Servlet: session.getAttribute("name");

Also refer : Sharing values between servet and JSP

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top