• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Help wanted please!!

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,
Just wondering would anybody know how do I click on any hyperlink (which is records from the database displayed as hyperlink) that i'm brought to the desired page. Here is my code, where database returns all the records to the JSP page as hyperlinks. But what happens at the moment is, whichever link in the table is clicked, u are brought to the same page ('ProductList.jsp'), while i want different pages for different links. I hope this isnt too confusing! Thank you!
<TABLE align ="centre" border= "5">
<TR>
<% for(int i=1;i<=rs.getMetaData().getColumnCount();i++)
{
%>
<TD><FONT size=5 FACE="Arial"></FONT>
<%= rs.getMetaData().getColumnName(i) %>
</TD>
<% } %>
</TR>
<% while (rs.next())
{ %>
<TR BGCOLOR="#ffff00">
<% for(int i=1;i<=rs.getMetaData().getColumnCount();i++){ %>
<%if (i==3){ %>
<TD><a href="ProductList.jsp?id=<%= rs.getString("categoryId")%>"><%=rs.getString("name")%><%=rs.getString("description") %></a></td>
<% } else { %>
<TD><%= new String(rs.getString(i)) %></TD>
<% }
}%>
</TR>
<% } %>

</TABLE>
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
If you want to link to a different jsps, then
1) Have a seperate column in the database to store jsp page names. Then along with other records retrive the jsp name.
<a href=<%=getString("jspname")%>?yourquerystring>
or at the page scope declare a string to store the jsp name, if there isn't too many jsps for different links. have a switch statement and according to the different case hard code the jsp names and return that to your href.
Regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic