Hello all,
I'm still a novice java developer working on creating a new application for our SAP portal, and I'm stuck on one little thing. Perhaps someone can help me out.
In a jsp page, I have an arraylist of objects. I use an iterator to go through each object in the arraylist. As I go through the arraylist, I use one attribute from each object to create an hbj link to display on the screen. The idea is that the user will be able to click on this link and see the rest of the attributes for that object. What I haven't figured out is how do I indicate which object's link has been clicked. In other words, once the link has been clicked, I don't know how to go through the arraylist to find the object whose fields I need to display.
I've tried setting up the onClick field in the hbj link area to pass a value to the method on the dyn page, but that errored out.
Here's relevant code from the jsp:
ArrayList supplierContacts = sup.getContacts();
Iterator i = supplierContacts.iterator();
String prevContactType = "";
while(i.hasNext()) {
Contact con = (Contact)i.next();
String contactName;
contactName = con.getContactLastName() + ", " + con.getContactFirstName();
String linkId = "contactLink" + con.getContactId();
%>
<TR>
<TD width=550 align=left>
<FONT face=arial size=2>
<LI>
<hbj:link
id="<%=linkId%>"
text="<%=contactName%>"
onClick="contactLinkClick"
linkDesign="REPORTING"
>
</hbj:link>
</LI>
</FONT>
</TD>
</TR>
<%
}
Here's the relevant code from the Dyn page:
public void onContactLinkClick(Event event) throws PageException {
nextJSP = "ContactDetails.jsp";
} // end method onContactLinkClick
Thanks in advance, I will award points for helpful answers.
-Stephen Spalding
Web Developer
Graybar