Solved

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

Posted on 2004-10-09
5
1,511 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

A safe way to clean winsxs folder from your windows server 2008 R2 editions
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now