Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Putting it together: Struts, Tags, OGNL  RSS feed

Eloy Vargas
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a very specific issue that I have researched all weekend and just can't find the right answer. It's driving me crazy!! I could proabably come up with a different solution, but I know I am close to making this work. I don't want to give up!!!

I am developing a Web application using Struts 2 and JPA/Hibernate. I have a great deal of experience with Struts 1.x and EJB 2 persistence but little with the more current technology. So I have decided I will upgrade my skills while I am working on this new development. I think I can explain my problem without including every line of code leading up to it.

In my JPA I have a DAO that reads all the instances of a one to many relationship and builds a list in the data object. I use auto increment for all my tables so all instances of the JPA objects will have an id field containing the key for the object. I have a situation where I need to display all the objects that exist under the primary and allow the user to select one of them along with other data. The radio button is just made for this. The description of the object is so long I want to build a vertical list of the radio buttons beside the lengthy description. Actually I am attempting to build a table with 4 columns. The first column is the radio button and the other three colums contain information from that instance. I want the value of each radio button to be the value of the id key value for each entry.

So in my JAP object I have a list of objects that represent the one-to-many relationship. I expose the primary object containing the list in my action class.

Here is the code in my jsp:

Notice what I have put in the list parameter of the s:radio function. The code generates output using this code. However, the value of every single entry is 1. Notice also that I have ${} beside the radio button. This contains the key that I want to use for the radio button. It displays on the page just fine.

I have researched for hours, hours and more hours. I have tried both "c:forEach" and "s:iterator". I can't get this to work!!!

I know the answer will be embarasingly simple but I want to replace the

With something like (I have tried NUMEROUS variations based on what I have encountered on the 'net):



Or whatever I can make this work properly.

Everything I have tried results in the error:

tag 'radio', field 'list', name 'masterKey': The requested list key '#{${}:''}' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

Please!! Help me with this. How do I change the list parm to make this work?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!