wood burning stoves
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Bean-based hyperlink not working" Watch "Bean-based hyperlink not working" New topic

Bean-based hyperlink not working

Alana Sparx
Ranch Hand

Joined: Feb 14, 2006
Posts: 121

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;
THe struts-config action


The struts-config form bean


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;}

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:

subject: Bean-based hyperlink not working
It's not a secret anymore!