aspose file tools*
The moose likes Struts and the fly likes Bean-based hyperlink not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Bean-based hyperlink not working" Watch "Bean-based hyperlink not working" New topic
Author

Bean-based hyperlink not working

Alana Sparx
Ranch Hand

Joined: Feb 14, 2006
Posts: 121
Hi

I am sure this is down to something simple, but I'm having no luck with it.


I am retreiving a collection of numbers from my business tier, iterating through this and displaying the contents as hyperlinks as per the above code. The html source generated by the above displays as:

What appears to be happening is that if I click on the hyperlink, the entire collection is sent to the ActionServlet. I can also send 'null', but am having difficulty in just sending the value represented within the hyperlink.

Your help, as always, appreciated.
Alana Sparx
Ranch Hand

Joined: Feb 14, 2006
Posts: 121
Still not working: have included some other info;
[code]
THe struts-config action

<action
path="/EligabilityPolicySubmit"
type="app.EligabilityPolicyAction"
name="eligabilityForm"
scope="request"
validate="true"
input="/pages/EligabilityQuery.jsp">
<forward
name="success"
path="/pages/EligabilityPolicyDisplay.jsp"/>
</action>

The struts-config form bean

<form-bean
name="eligabilityForm"
type="app.EligabilityPolicyForm"/>

The eligability form bean
/..
public void setPolicyNumber(String policyNumber){this.policyNumber = policyNumber;}
public String getPolicyNumber(){return policyNumber;}
public void setDescription(String description){this.description = description;}
public String getDescription(){return description;}
public void setPolicyId(String policyId){this.policyId = policyId;}
public String getPolicyId(){return policyId;}
../
[code]

Thanx
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
First off...the id attribute of the logic:iterate is the name of the current item retrieved from the list. It seems that a name like "accountId" would be better than "listAccountIds". Second...I would expect your html:link tag to reference the current item (your id attribute) and included a paramId. I am not real clear what your beans look like (you mention account id and policy id). Maybe something like this would work:


This should generate links with a parameter "policyId" like this:

- Brent
Alana Sparx
Ranch Hand

Joined: Feb 14, 2006
Posts: 121
Cheers Brent

I was getting mixed-up between what each of the tags specifically referred to, but managed to get some feedback on comp.lang.java.programmer, to the effect my link now looks like:


Cheers
A
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bean-based hyperlink not working
 
Similar Threads
Problems with Beans' properties in JSP
logic:iterate display entries
Arranging list data
How can this be done better (html:link)
How to Introduce a Button That Controls All Other Links in a Web Page