Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

pass jsp values of textbox through servlet as entry point to other jsp file

Posted on 2004-10-09
5
Medium Priority
?
1,551 Views
Last Modified: 2006-11-17
pass jsp values of textbox through servlet as entry point to other jsp file:

i am having one jsp page with text boxes,
jsp page is requesting to entry servlet
i want to pass values which is redirected to other jsp

can you help, when i try to retrieve values i found them null


Regards
0
Comment
Question by:evaibhav
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 1000 total points
ID: 12269600
in servlet coding do like this

request.setAttribute("TextBoxValue",request.getParameter("TextBoxValue"));
RequestDispatcher dispatcher = getRequestDispatcher ( "yoursecondjsp.jsp" );

if ( dispatcher == null ) {
            throw new Exception ( "Unable to find yoursecondjsp.jsp " );
            }
      //      Pass control to the jsp page , which will write directly to the output stream.
      dispatcher.forward (request, response);

----
in second jsp

String textBoxValue=(String)request.getAttribute("TextBoxValue");



0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 1000 total points
ID: 12296853
if you are using dispatcher.forward then you need not to set attribute. in forward the request object is passed as is so in the second jsp you should be able to do a simple request.getParmaeter("TextBoxValue") and it should give you the values.
I think the problem is that you are using .redirect() method. redirect makes a new request and response and as a result setAttribute will not work either.

if you have to use redirect then its better to put your values in session and retrive it from there...
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12537275
:)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question