View Single Post
Join Date: Jul 2007
Posts: 16
Reputation: khalidmehmood is an unknown quantity at this point 
Solved Threads: 0
khalidmehmood khalidmehmood is offline Offline
Newbie Poster

Create Dynamic Hyperlink

 
0
  #1
Jan 5th, 2009
Hi Experts!
I am trying to build dynamic hyperlinks but i cant do this. i am new to JSP. please guide me.
here is my code:

  1. <%
  2. try{
  3. Class.forName("com.mysql.jdbc.Driver").newInstance();
  4. connection = DriverManager.getConnection(connectionURL, "root", "root");
  5. statement = connection.createStatement();
  6. rs = statement.executeQuery("SELECT * FROM contacts");
  7. while (rs.next()) { %>
  8. <a href="viewdata.jsp?value1="+<%rs.getString(1)%>+">"+<%out.println(rs.getString(1));%></a>
  9.  
  10. <%}
  11. rs.close();
  12. }
  13. catch(Exception e)
  14. {
  15. out.println(e);
  16. }
  17.  
  18. %>

how can i build the dynamic hyperlink with out.println inside JSP <%%> tag

regards
Khalid Mehmood
Last edited by peter_budo; Jan 5th, 2009 at 5:46 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote