• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help wanted please!!

 
Donna Harrington
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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>
 
Suma K Gowda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!