Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't get values from h:selectManyCheckbox

 
Nicole Williams
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a getter and setter for your property?
 
Nicole Williams
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I do :/
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does your PdfManager.lieferantenListe contain, it would be helpful to see the code snippet of the bean
 
Nicole Williams
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that look's right, do you have a getter for the items?
 
Nicole Williams
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kavita Tipnis wrote:that look's right, do you have a getter for the items?


yepp.. here is my Bean:

 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Problem, hope you figure out that soon :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic