permaculture playing cards*
The moose likes Struts and the fly likes Problem Struts : get checked multibox (Session/form/request) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem Struts : get checked multibox (Session/form/request)" Watch "Problem Struts : get checked multibox (Session/form/request)" New topic
Author

Problem Struts : get checked multibox (Session/form/request)

y Isola
Greenhorn

Joined: Aug 19, 2010
Posts: 4
Hi guys.
I've got a serious problem for 3 days. I can't get the right value of the multibox and the rigth bean, whatever I store my bean in scope session or request or as an attribut of my form.

Here is the code I use :

In the InitAction class before the jsp page listing all the parameter values' of the bean userVO

/*INITACTION JAVA*/


/*INITACTION JAVA*/

Here is the code used in my jsp :
/*JSP*/


And in the identityUser_inc.jsp :


/*JSP*/

Here is my struts-config code :
/*STRUTS CONFIG*/


/*STRUTS CONFIG*/

Finally, here is my UpdateUserAction class :

/*UPDATE ACTION*/


/*UPDATE ACTION*/

I tried every solutions and search dor hours on the web, I'm really desperate now , so any idea would be appreciated.


Regards,

Apocys.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What happens if you put the form input elements directly in the parent JSP rather than splitting it off into a separate file?
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi,

Do you have the proper getters and setters in your Form bean that will pick
up the multibox values?


"Eppur si muove!"
y Isola
Greenhorn

Joined: Aug 19, 2010
Posts: 4
Hi, in my FormSelectionUser formBean I have :


And I have the same in my UserVO bean, a getter and a setter, for the attribute groups (etc...)

Then, I try to pick up the attribute groups of my UserVO bean, but I can't access UserVO because it's not visible in scope request or in the form.

In fact, my question is, Is it possible to set a bean in scope session or in a form, access a String[] attribut of that bean into a jsp page to "multibox it" and on submit get the bean back with those modifications ?

How can I do that ?

Thanks for the reply

to David Newton : Unfortunately, I must split my file off

Regards,

Apocys.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

y Isola wrote:to David Newton : Unfortunately, I must split my file off

That's not really my question: I'm asking what happens if you don't, and I'm asking for a reason.
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
y Isola wrote:In fact, my question is, Is it possible to set a bean in scope session or in a form,
access a String[] attribute of that bean into a jsp page to "multibox it" and on submit get the bean
back with those modifications?


Putting a bean in the scope session is possible, but I don't think your changes on the multi-boxed
items will be reflected automatically in the same bean.

When you need to read the multibox there are some other things that need to be put in place,
one of them is the String array of selected items that is returned from the jsp...

This is what you would be likely to see in the action form bean.



In the action bean you process the selectedUsers array.

Additionally, when you are displaying the values in the jsp it is
handy to use the org.apache.struts.util.LabelValueBean, for
example like this (in the Action bean)



I hope this helps you out...
y Isola
Greenhorn

Joined: Aug 19, 2010
Posts: 4
Hi Gian Franco and David Newton,

Sorry for the delay in my reply, I'll try to do as you said today

Thanks a lot
 
jQuery in Action, 2nd edition
 
subject: Problem Struts : get checked multibox (Session/form/request)
 
Similar Threads
multibox functionality in struts
Iterator and multibox
multibox , resultSet, logic:iterate
multibox - nullPointerException
hidden for radio and multibox