aspose file tools*
The moose likes JSP and the fly likes How to pass value to other page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to pass value to other page" Watch "How to pass value to other page" New topic
Author

How to pass value to other page

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
Hi

I am using -:

String name="myName";
RequestDispatcher disp = request.getRequestDispatcher("a.jsp");
disp.forward(request, response);

now i want to pass this variable ( name ) to other page where i am forwarding the page and i write -:

RequestDispatcher disp = request.getRequestDispatcher("a.jsp?name=<%= name%>");
disp.forward(request, response);

but it is givimg error that String Constants are not closed properly,
but when i write -:

RequestDispatcher disp = request.getRequestDispatcher("a.jsp?name=amit");
disp.forward(request, response);

then it works fine, could you please tell me the reason and what is the proper way.

Thanks
Regards
Gaurav
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you're already in a scriptlet block, you don't need the JSP expression.


Just use the variable.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass value to other page
 
Similar Threads
Foward an http request from a servlet to an Oracle Package Procedure
Is there something wrong with the RequestDispatcher?
RequestDispatcher problem
Interesting problem in Forwarding request dispatcher
Call a servlet from another servlet