Passing parameters from a Jsp page that does not have a <form> or page body

From my main JSP that has a form and form elements, I call action.jsp that does some validations and pass the data to java classes.
action.jsp does not have any <form> or  body. But has the return data from my java classes.

I would like to forward the user to thanks.jsp and also display the return data from action.jsp.

How can I pass these parameters to thanks.jsp?
1. I tried to pass as hidden, but since there is no <form>, it does not work.
2. response.redirect did not seem to pass the parameters
3. One suggestion on EE was
RequestDispatcher reqDisp = request.getRequestDispatcher("/thanks.jsp");
reqDisp.include(request, response);
<%@ page errorPage="Exception.jsp" %>

But it does not work either....

When I execute it, the control always goes to exception.jsp and there is no log entires.  Can you tell me what could be the error?
Also, how can I see the actual error mesage when I use <%@ page errorPage tag?
Thank you.
mytiligAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
Store them in the session...

    session.setAttribute( "object1", o1 ) ;
    session.setAttribute( "object2", o2 ) ;

    etc

Then

    session.getAttribute( "object1" ) ;

on the other side...

I would do validation AND processing in action.jsp and then put the results into the session for the next page to pick up after the redirect

Tim
actonwangCommented:
>>RequestDispatcher reqDisp = request.getRequestDispatcher("/thanks.jsp");
reqDisp.include(request, response);

     This should be a better way because your action.jsp looks like a controller (a servlet like). But here are a few things you need to make sure:

      (1) is "/thanks.jsp" your a correct path? The path is relative to your context root. If your thanks.jsp is inside a subdirectory under your web root, you need to provide it as "/subfolder/thanks.jsp". OR, if thanks.jsp is in the same folde r as action.jsp, just write it as "thanks.jsp" (this might be your choice).
      (2) you might use reqDisp.foward(request,response) instead of reqDisp.include(...).
      (3) you need to put your value into request object in your action.jsp as:
            request.setAttribute("param1",value1);
           and take it out  in thanks.jsp as:
           request.getAttribute("param1").
       
       see this: http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/RequestDispatcher.html

     btw: You can look at the log file to see detailed error message.

Enjoy :)
Acton
actonwangCommented:
Another might be easier way is to use :

<jsp:forward page="thanks.jsp">
   <jsp:param name="param1" value="<%=value1%>" />
</jsp:forward>

The good thing in java world is that you always can come up with a lot of solutions. Unless I find 3 ways to do it, I never stop :)

Enjoy
Acton

 

 

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
Ok try out this one.

When you are in action.jsp after validating every thing put the data on to the session using session.setAttribute("SessVar",your variable name");

the forward using jsp:forward to the Thanks page.

And there you retrieve back the data from the session & display.

Thank You.
actonwangCommented:
shivaspk,

          TimeYate already said that ...

         Also, I already mention jsp:forward and you don't need session if you use that.  I already list all possible solutions VERY clearly. You can look at my comments to learn it.

Acton
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.