aspose file tools*
The moose likes JSF and the fly likes can't get values from h:selectManyCheckbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "can Watch "can New topic
Author

can't get values from h:selectManyCheckbox

Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
Hello guys!

I'm using Seam and want to create a PDF using some values the user is choosing with checkboxes before. My problem is that I can't get values from the selected checkboxes Maybe I'm using the wrong format or I don't know how to submit the values correctly... Here is my code:

checkboxes and the link to pdf:



I want to fill this array from my bean:


and here is my output which is always empty (although I can read other values from the bean):


Would be great if you have some advice for me!
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
Do you have a getter and setter for your property?
Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
yes I do :/
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
what does your PdfManager.lieferantenListe contain, it would be helpful to see the code snippet of the bean
Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
Kavita Tipnis wrote:what does your PdfManager.lieferantenListe contain, it would be helpful to see the code snippet of the bean


for now it's just a list of hard coded Strings:


I expect those strings to come to my array "liefernante2print", but they don't ;/
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
that look's right, do you have a getter for the items?
Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
Kavita Tipnis wrote:that look's right, do you have a getter for the items?


yepp.. here is my Bean:

Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
First,I don't see the value changed being invoked. Second, how are you testing the selected values? (using logger or system.out)
I just put together a small example that works.

jsp file

Bean (session scoped)
Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
I was testing the selected values in PDF output:


In my PDF I only get:

List1:
1. Lieferant1
2. Lieferant2
3. Lieferan3
List2:


Well I now tried to integrate your code in mine and also put println but it doesn't work neither..
Here is my bean now:



and here is my html snippet:



As output I only get

can't see where is the difference between your code and mine
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
r boo wrote:I was testing the selected values in PDF output:




I don't think you can test List2 by just using the 'var' , that violates EL expressions API referencehttp://java.sun.com/javaee/5/docs/api/
But leaving that aside , I suggest you separate out your pdf generation code and test it and if that works then add the pdf generation.
Also, I may not get completely what you are doing but I am just trying to figure out what your problem might be!
I just noticed you have a request parameter named 'dokId' but then in your jsp you have it named 'dokumentEntityId' ...
Nicole Williams
Greenhorn

Joined: Oct 08, 2009
Posts: 9
Kavita Tipnis wrote:
r boo wrote:I was testing the selected values in PDF output:




I don't think you can test List2 by just using the 'var' , that violates EL expressions API referencehttp://java.sun.com/javaee/5/docs/api/
But leaving that aside , I suggest you separate out your pdf generation code and test it and if that works then add the pdf generation.
Also, I may not get completely what you are doing but I am just trying to figure out what your problem might be!
I just noticed you have a request parameter named 'dokId' but then in your jsp you have it named 'dokumentEntityId' ...


well yes, I'm not doing PDF generation now, I copied your command button to my xhtml and myAction with println to my bean and it shows me that my list with selected items is empty..
but thank you anyway for your time!
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
No Problem, hope you figure out that soon :-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: can't get values from h:selectManyCheckbox