• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pass paramter between jsp page

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i pass the parameter to another jsp from jsp based on the clicking linkage.

as i retrieve data from the resultset,so the linakage should be
<% while rs.next()){%>
<%=rs.getString("ID")%>
<%}%>

when the user click on the link, then pass the ID value to second.jsp accordingly.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've got Java code in a JSP? Doing database access?

You should really read up on modern JSP. Putting java code in a JSP has been a discredited practice for over 8 years now.

In any case, regardless of where the data comes from, the answer is the same: put the value as a request parameter in the query string of the link URL.

The <c:url> JSTL tag can help you properly format and encode the URL.
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as the page is already in the frame of another page.
so when the user click on the linkage, the target should be _self.
the URL still be the page file contain this frame.
no change of the url when user click the linkage.

by the way, if i don't get the resultset and then read it on jsp.
what should i do?

one of the advantage using jsp is it can be conbime java and html.
why not.

sorry, i am beginner to use jsp,so i ask more about this programming language.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ll Gii wrote:one of the advantage using jsp is it can be conbime java and html.
why not.


No, that is a distinct disadvantage and leads to a horrible horrible mess.

Modern JSP best practices dicate no Java on JSP pages. If you are just leaning JSP, you should learn how to do it correctly, right off the bat.

You might want to read this article and this article.

Back to your question: what do you mean by "no change of the url when user click the linkage". If you cannot change the URL, you cannot accomplish your goal.
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a home.jsp containing 3 frame in the page(top ,left, and then right)
the page content.jsp is in the right frame contain the following code:

just change the

if i change to
<%=rs.getString("ID")%>+"'" target="_self">

the url at the browser will not be change ,still is home.jsp after clicking the link.

so how to get that ID value from aaa.jsp pass from content.jsp
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic