HI Dave,
Thanks for your reply. Full source code below for JSP page.
The text of the hyperlink from something like
objectArray[i].getDBfield1Data().toUpperCase()
resolveds to a string from one field in one record of a table in a database.
For example, lets say you have a table called Process. In the table process, you have a "PK" field, which is a unique row number (I know you understand all these concepts, but I'm just trying to go step by step <s>
.
A bean that does the database lookup builds a list of array objects. Each object in the array is just a "class" with three fields (first field is for the table to search, and the other two fields are fields in that table to get field information from).
So, in every element of the array, each of these three fields holds one record with the string for the two fields in this record (plus, the table name in the first field).
The loop above creates a hyperlink based on the contents of the field's data from the array filled in by the bean.
So when the user clicks a link (Master info), I want to display the detail information for the actual link clicked in either another JSP page, a servlet, or what/where ever.
So, it seems like I have to somehow send the link's text to the next JSP page, servlet or what/where ever.
Here's the entire JSP code. I appreciate your patience and help!!! <s>
--------------------------------------------------
JSP CODE:
<%@ page import="dbaccess.DBFields" %>
<jsp:useBean id="SQLData" scope="application" class="dbaccess.DBAccess1" />
<FORM ACTION="http://localhost:8081/DBAccess_3.jsp" METHOD="POST">
</body>
<h1>
Display Messij Database Table Info.
</h1>
<p>
<jsp:setProperty name="SQLData"
property="tableName"
value= '<%= request.getParameter("tableName") %>'/>
<jsp:setProperty name="SQLData"
property="pkFieldName"
value='<%= request.getParameter("pkNameField")%>'/>
<jsp:setProperty name="SQLData"
property="nameField"
value='<%= request.getParameter("nameField") %>'/>
<% DBFields[] objectArray = SQLData.getDBFields();%>
<% out.println("<B> Table Name=</B> " + SQLData.getTableName()); %>
<p>
<% String tableName = request.getParameter("tableName"); %>
<%session.setAttribute( "theTableName", tableName );%>
<% String pkNameField = request.getParameter("pkNameField"); %>
<%session.setAttribute( "thepkNameField", pkNameField );%>
<% String nameField = request.getParameter("nameField"); %>
<%session.setAttribute( "theNameField", nameField );%>
<p>Name field entered: <jsp:getProperty name="SQLData" property="nameField" />
<p>Primary key entered, <jsp:getProperty name="SQLData" property="pkFieldName" /><br>
<p>
<hr><br>
<UL COMPACT TYPE=SQUARE>
<%
if ( objectArray != null)
{
for (int i = 0; i < objectArray.length; i++)
{
out.println("<p><L1>Table Name: <A HREF='http://localhost:8081/DBAccess_3.jsp?id=1'/>" + objectArray[i].getDBfield1Data().toUpperCase()+ "</A>") ;
out.println("<p><L1>Name Field: <A HREF='http://localhost:8081/DBAccess_3.jsp?id=2'/>" + objectArray[i].getDBfield2Data().toUpperCase()+ "</A>") ;
out.println("<p><L1>Primary Key: <A HREF='http://localhost:8081/DBAccess_3.jsp?id=3'/>"+ objectArray[i].getDBfield3Data().toUpperCase()+ "</A>");
out.println("<p> ---------------------------------------------------------- <p>");
}
out.println("<p>"+ objectArray.length + " Records Retrieved.");
}
else
out.println("<p><H2> Sorry, no records found for your entered query. </H2> ");
%>
</UL>
</BODY>
------------------------------------------------
>>>> End of JSP code <<<<
------------------------------------------------
If I click one of the records (hyperlinks) created above, I would get the following response form the next JSP page (assuming I click the "PK" link, which is the id=1 hyperlink above:
Greetings from DBAccess_3.JSP
You want to get all records by Primary Key Field.
-------------------------------------------------
Table Name Passed -- Process
Name Field Passed -- Pro_Name
PK Field Passed -- PRO_PK
-----------------------------------------------
END of JSP output
------------------------------------------------
Here, based on "id=" field, I have identified which of the three hyperlink "Types" they clicked. I have identified the three fields returned from the bean from the previous JSP page, but I still don't know which link (record number, etc.) from the array they clicked on....so I can't do a database lookup for the actual item they clicked on to give them detail.
Does this extra detail help?
I really appreciate your support.
-- Mike