Results 1 to 4 of 4
  1. #1
    java_$life is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default can we send request attributes from one jsp to jsp

    In the below code i m trying to send my request attribute from req.jsp page to retr.jsp.

    i would like to know if we can pass request attributes from one jsp page to other jsp page


    the below is my req.jsp

    <html>
    <head>
    hey i m page 1
    </head>
    <body>
    <% request.setAttribute("info ","info from page1"); %>
    <% RequestDispatcher dispatch=request.getRequestDispatcher("/retr.jsp");
    dispatch.forward(request,response);
    %>
    </body>
    </html>


    this is my retr.jsp


    JSP Syntax (Toggle Plain Text)
    <html>
    <head>
    i m gettin request from page1
    </head>
    <body>
    <%=request.getAttribute("info")%>
    </body>
    </html>

    I would lik you to tell me the way to do.
    Thank you
    Last edited by java_$life; 06-23-2010 at 08:07 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Put the value as a hidden field on a form that you submit.

  3. #3
    java_$life is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default

    ohh..ok
    but can u tell me whats wrong in the code i ve written above

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You don't have the form to submit and you are using java code in JSPs which was bad in 1999.

Similar Threads

  1. Replies: 10
    Last Post: 06-06-2010, 06:49 PM
  2. Problem with static attributes
    By AndreRodrigues in forum New To Java
    Replies: 5
    Last Post: 01-03-2010, 07:31 AM
  3. Replies: 0
    Last Post: 09-10-2009, 12:35 PM
  4. Methods and Attributes Layout
    By Bascotie in forum New To Java
    Replies: 2
    Last Post: 01-16-2009, 12:53 AM
  5. How to read AIX attributes & values.
    By John_28 in forum New To Java
    Replies: 5
    Last Post: 05-05-2008, 08:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •