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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax to make a string field in table link to another jsp page.

Status
Not open for further replies.
Jan 8, 2001
163
US
Hi all. I have a jsp page that takes a bunch of users and lists them and their user information (firstname lastname etc) in a table.

ie/

Username Firstname Lastname Company StartDate EndDate
ABJ1 John Doe Smith Co 01/01/01 02/02/02
UBL3 Jane Doe Smithe Co 01/01/01 03/02/02

I would like to know the syntax that would enable the user to click on any given username and be taken to the next jsp page where they can edit that user and their given information. Say the next jsp page is called EditUser.jsp.

Here is my excerpt of my code so far. This is all within a while loop that detokenizes a hashtable to retrieve the users information where username is the hashtable key....

%>

<TR valign=&quot;top&quot; bgcolor=&quot;#CCCCC&quot;>
<TD><%= username %></FONT></TD>
<TD><%= userid %></FONT></TD>
<TD><%= u_firstname %></FONT></TD>
<TD><%= u_lastname %></FONT></TD>
<TD><%= u_startdate %></FONT></TD>
<TD><%= u_enddate %></FONT></TD>
<TD><%= company %></FONT></TD>
</TR>
<%


I'd appreciate your help with this.

Thanks,
CrystalVisualBOracle :)
 
Ok, to start off let me call the page of users, list.jsp, and the individual user page, user.jsp. Following are simple examples of how to get started with each page. Since I don't know the details of your design I can only generalize at some parts.
In list.jsp:
Code:
<TR valign=&quot;top&quot; bgcolor=&quot;#CCCCC&quot;> 
  <TD><a href=&quot;user.jsp?userid=<%= userid %>&quot;><%= username %></a></FONT></TD>
  <TD><%= userid %></FONT></TD> 
  <TD><%= u_firstname %></FONT></TD> 
  <TD><%= u_lastname %></FONT></TD> 
  <TD><%= u_startdate %></FONT></TD> 
  <TD><%= u_enddate %></FONT></TD> 
  <TD><%= company %></FONT></TD> 
</TR>
In user.jsp:
Code:
<html>
<head>
<title>User Edit Page</title>
</head>
<body>
<%
String userid = request.getParameter(&quot;userid&quot;);
if (userid != null && userid.trim().length() != 0) {
  /* Retrieve and display user for edit */
}
else {
  out.println(&quot;No user specified&quot;);
}
%>
</body>
</html>
Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top