How can this be done better (html:link)

Adding unique params to the url. I am getting a list from the database and making the primary keys links so that a individual record from the db can be used. I can quite easily display the rows using html:link tags (not shown) but I have been having trouble adding the dynamic unique param to the end of the url.(simple stuff but seems tricky in struts). Links would look like: /iNet/execute/viewSelectedNews?newsId=1 /iNet/execute/viewSelectedNews?newsId=2 /iNet/execute/viewSelectedNews?newsId=n This is my current working solution. But its not ideal. The Collection holds NewsVO objects. It only has a single field for simplicty (newsId). Can some liet me know if there is a way to lose the scriptlet code?

One thing to note is that the value returned from your collection, what we refer to as "news" in the id property of the iterate tag, needs to be a String in order to be referenced by the paramName property of <html:link>.

Are you sure the NewsVO class is overriding the toString() method properly? Looks to me like it is using the standard toString method from Object. Like Jason said, the paramName attribute has to be a String, so you need to either return the value you want from the toString method or create a getter for the value and access it as a property. E [ December 09, 2003: Message edited by: Eric Fletcher ]

My theory of evolution is that Darwin was adopted. - Steven Wright

James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190

posted Dec 10, 2003 02:46:00

0

The NewsVO class is doing this:

Do you see a problem? Thanks

James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190

posted Dec 10, 2003 02:48:00

0

IGNORE PREVIOUS MSG _TYPO - THIS ONE IS CORRECT The NewsVO class is doing this: