Solved

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

Posted on 2004-10-09
5
1,533 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 250 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 250 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

While it may be true that the internet is a place of possibilities, it is also a hostile environment lurking with many dangers. By clicking on the wrong link, trusting the wrong person or using a weak password, you are virtually inviting hackers to …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 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