2

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

Lacoste1112
  • 105
  • 1
  • 3
  • 8
  • You need to provide more information about the relationship between your JSP and your servlet. There are many different ways that JSPs and servlets can interact and without those details your question cannot be answered. – EJK Nov 09 '13 at 05:52
  • http://getch.wordpress.com/2011/12/28/sharing-values-between-servlets-and-jsp/ – constantlearner Nov 09 '13 at 05:58
  • @EJK... ok EJK i am gonna try something. if i'll not successful then i update my answer with that. – Lacoste1112 Nov 09 '13 at 06:43

1 Answers1

1

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

Community
  • 1
  • 1
kark
  • 4,763
  • 6
  • 30
  • 44
  • ok, i'll try this.... what about use the value i get from the servlets which i want to use in the same jsp or in others. – Lacoste1112 Nov 09 '13 at 06:39
  • I just mentioned that you can pass it from servlet to JSP...by this Pass variables from servlet to jsp question – kark Nov 09 '13 at 08:02