• 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

Whats wrong with this line of code???

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get the following values from the database:
String topicid = rs.getString("topicid");
String title = rs.getString("title");
And I can display these in broswer ok, simply out.print("topicd"); etc...
However when I want to print out the title, and make it a link to open up a new jsp page displayTopic.jsp?topicid='"+topicid+"' ( from resultSet rs),
it doesn't seem to display the title as a link properly in the browser.
Can anyone spot any obvious errors in the following line of code:
out.print("<td width='60%'><a href='displayTopic.jsp?topicid='"+topicid+"' '>" + title + "</a></td>");
Some help please....???
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Annmarie,

Note that these two pieces of code are different. The first displays the six letters "topicd". The second prints the value of the variable topicd. You want the second one to make sure the variable contains what you want it to.
 
Annemarie McKeown
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry my mistake I should have actually written out.print(topicid);
Thats not where my problem is though, something within the long line code out.print("<td>".........
is not displaying in the browser as it should.
I want it to display
title as a link, the user can click on title which will open a new page, passing topicid (?topicd=topicid).
Do you know whats wrong with that line of code.?
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want topicid=xxx, don't u want
out.println("<td width='60%'><a href='displayTopic.jsp?topicid="+topicid+"'>"...)
instead of:
out.print("<td width='60%'><a href='displayTopic.jsp?topicid='"+topicid+"' >");'>" + title + "</a></td>
(you have an extra ' in the code originally)
which gives you
topicid='xxx' ?
perhaps you should just right click on the link (if you are using IE) and copy shortcut so you can tell what the link points to?
Adrian
[ March 07, 2004: Message edited by: Adrian Pang ]
[ March 07, 2004: Message edited by: Adrian Pang ]
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic