Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

20 Experts available now in Live!

Get 1:1 Help Now