Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Content - Crying for help ...... Urgent 1

Status
Not open for further replies.

Selemani

Programmer
Apr 18, 2007
6
0
0
IE
Hello

I am new to this forum, maybe this issue has been resolved already. Please Help!

I have been asked to build a small system that will do certain things. I am using Tomcat with JSP. The connection and the interaction to the database are great. The only issue I am having is that I don't know how to link/convert the result of the query displayed on the screen to a clickable content i.e. a link.
Eg: When the user wants to view all the European cities, he will click on view all cities on a web page. The code behind the "view" button is a select query that will be run and display back all the cities from a database. My problem is that I don't know how to make the result of that query a link. Let say, if the user wants to click on one of the cities, example Dublin, how can i generate a link from a dynamic page?

I hope it makes sense!
 
That was brilliant Diancecht. That is exactly the kind of things I am looking for. However, I am using JSP with JSTL tags.

When the user searches for example all the names in the address book database starting with A, he should be able to get a list like: Alan
Alino
Alfred
Angel
And then, if he decided to view relevant information concerning Angel, he can only click on Angel to either view, modify or delete.

Thank you for your help
 
This is my code:

<sql:setDataSource var="TableView" driver="sun.jdbc.odbc.JdbcOdbcDriver" url="jdbc:eek:dbc:Reports"/>
<sql:query var="all_fields" dataSource="${TableView}" scope="session">
SELECT MegaDoc.name, MegaDoc.Description
FROM MegaDoc
WHERE MegaDoc.name = ?
</sql:query>

<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>

<c:forEach items = "${all_fields.rows}" var ="row" >
<tr>
<td align="left"><font size="2"><c:eek:ut value = "${row.name}" /></font></td>
<td align="left"><font size="2"><c:eek:ut value = "${row.Description}" /></font></td>
</tr>

</c:forEach>

</table>
 
sorry dont do much java but can't you just do this:

Code:
<c:forEach items = "${all_fields.rows}" var ="row" >
        <tr>
         <td align="left"><font size="2"><a href="whatever_url.jsp?Name="<c:out value = "${row.name}" />><c:out value = "${row.name}" /></a></font></td>
         <td align="left"><font size="2"><c:out value = "${row.Description}" /></font></td>
        </tr>
      
</c:forEach>

Thus passing the name to the querystring.
 
Thank you Nickdel, I did something like that, and I got it working fine. Thanks everyone for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top