wood burning stoves 2.0*
The moose likes Struts and the fly likes display and posting of sets of controls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display and posting of sets of controls" Watch "display and posting of sets of controls" New topic
Author

display and posting of sets of controls

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hello
I have a sets of controls, radio, checkbox, from records that I would like to display, allow user edit of and then post to simultaneously. I can display the data by using simple string[] form but the html has the same name for all the name attributes so there are dup problems when I post. I need it to increment automatically. I have looked at nested tag library. Is it possible to have in the form string[][] and have the first index of the string[][] be the record number displaying/posting to and the second dimension be the value? Would this work on posting also? tia.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I would recommend that you not use arrays, either single or double-indexed. I'd recommend that you use some form of java.util.Collection for the list and JavaBeans to represent items in the list. Once you do this, you can use indexed properties to access them. For more information on how to use indexed properties along with a working example, see question 6 of our FAQ.


Merrill
Consultant, Sima Solutions
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hi Merrill
I was able to get rather far, even with multibox however the problem is array of radio button that I need discrete for each record/object in the outer collection. I almost have it however I cant get the index to increment. I have defined an array of objects that contains my values and use nested. This struts code works, again except for the index. Is it possible to get it to increment the index for each outer loop of objects in the collection? (What I am calling current). I have tried all manner of combinations and permutations of the attributes and even switched progressively to the standard logic:iterate. Any help on the index issue would much appreciated



produces this html for all objects in the looping collection
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hello
Let me try this again and be more specific.
I have defined a data object, ABCDObjectLV


I have defined a formBean radioTest with a line like this


I populated this object from my pre-Action with a line like this:

I have this for the struts


and it errors with
"cannot find symbol; symbol : method setValue(org.apache.struts.util.LabelValueBean), location: class org.apache.struts.taglib.nested.html.NestedRadioTag

The outermost loop is getting a session collection of radioTest object and iterating through it exposed as current. This looping structure is working for other fields in radioTest and properly showing.

Ultimately I want struts to index the radioOptions01[] so each set of radio buttons are discrete. I really didnt expect the error. I know I havent worked on getting the value into syntax, I just need to get the overall structure working first. Is this even possible? There must be some technique that allows the display of at least one array of radio buttons to be indexed serially per record in a group of records. Any elucidations appreciated.
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hi
Sorry for the persistence of this level of obtuseness, however I really want to get this to work. Now exploring struts-el with the same structure as above and this struts code:


I am getting:
javax.servlet.jsp.JspException: Invalid page context selector Radio
at org.apache.struts.taglib.bean.PageTag.doStartTag(PageTag.java:96)
at org.apache.strutsel.taglib.bean.ELPageTag.doStartTag(ELPageTag.java:100)

even if I wrap the html-el:radio around the bean-el. Can/How do I make this work? tia
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display and posting of sets of controls
 
Similar Threads
Redirect action struts 2
IllegalStateException: Cannot forward after response has been committed
jstl and jsp question - edited and reposted
reset form inside frame after submit
How To Create a Form That Contains Two Drop-Down Menus?