Results 1 to 4 of 4
  1. #1
    maas is offline Member
    Join Date
    Jul 2010
    Posts
    30
    Rep Power
    0

    Default Passing Paramters between jsps through URL

    Dear All,

    I am having a code that I have retrieved the date in the jsp and post the serach results in a table.

    Now I am tring to give the user the ability to click on the cir_id and the view page will be shown to them.

    So, how can I pass the cir_id in the URL to the next page and receive it on the next page?

    here is my code

    XML Code:
    <% 
    while(rs.next()){
    %>
    <td width="3%"><span style="font-size: 8pt"><%=rs.getString("cir_seq")%></span></td>
    <td width="14%"><span style="font-size: 8pt"><a href="cir_view.jsp?"><%=rs.getString("cir_id")%></a> 
    </span> </td>
    <td width="37%" ><span style="font-size: 8pt"><%=rs.getString("institution_name")%></span></td>
    <td  width="9%" align="left"><span style="font-size: 8pt"><%=rs.getString("request_from")%></span></td>
    <td  width="9%" align="left"><span style="font-size: 8pt"><%=rs.getString("request_date")%></span></td>
    </tr>
    It tried to add after the cir_view.jsp?<%=cir_id%>, but it shows null when it goes to the next page

    can you pelase help

  2. #2
    arun9683 is offline Member
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    70
    Rep Power
    0

    Thumbs up

    Pass like the following..

    Java Code:
    <a href="cir_view.jsp?cir_id=<%=rs.getString("cir_id")%>">
    <%=rs.getString("cir_id")%>
    </a>
    Arun K R,Bangalore,India
    :)

  3. #3
    maas is offline Member
    Join Date
    Jul 2010
    Posts
    30
    Rep Power
    0

    Default

    Thank you

    I will try

  4. #4
    mangstadt is offline Member
    Join Date
    Jul 2010
    Location
    USA
    Posts
    19
    Rep Power
    0

    Default

    Quote Originally Posted by arun9683 View Post
    Pass like the following..

    Java Code:
    <a href="cir_view.jsp?cir_id=<%=rs.getString("cir_id")%>">
    <%=rs.getString("cir_id")%>
    </a>

    That will work fine if the ID is a number, but you should encode the parameter to be safe.

    Java Code:
    <a href="cir_view.jsp?cir_id=<%=java.net.URLEncoder.encode(rs.getString("cir_id"), "UTF-8")%>">
    <%=rs.getString("cir_id")%>
    </a>

Similar Threads

  1. passing something
    By dinosoep in forum Threads and Synchronization
    Replies: 2
    Last Post: 12-05-2009, 10:26 AM
  2. passing a db connection across jsps throughout a session
    By Tirka in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-18-2009, 02:32 PM
  3. Design Editor For JSPs
    By jazz17782 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 01-12-2008, 01:52 AM
  4. jsps with html
    By gayatridevi in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 12-31-2007, 01:42 PM
  5. jsps with html
    By gayatridevi in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-19-2007, 12:06 PM

Posting Permissions

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