-
1. Re: Dynamic form and SEAM
giant2 Oct 24, 2011 5:52 AM (in response to giant2)In particularly I refer to this situation:
2 textfields inserted with <c:forEach>
1 button to see what user wrote in these 2 textfields.
Both textfields (values) are part (List) of a session object.
See the code below (in action the button):
for (int i=0;i<txtfields.size();i++){
El el=txtfields.get(i);
System.out.println(el.getId()+" "+el.getTxt()+" "+el.getVal());
}
I see only the last textfield value is really present in getVal, the first one is ever blank.
I see the html code produced for the page and see:
<input type="text" value="" name="xxxForm:j_id17">
<input type="text" value="" name="xxxForm:j_id21">
so the two textfields have different name.
I try to change the order and see only the last one is valuated.
Why only the last???
Is it a problem of Seam with dynamic form or a wrong way to develop? -
2. Re: Dynamic form and SEAM
vata2999 Oct 24, 2011 7:51 AM (in response to giant2)In this case i recommend Inject Seam Built in Parameters component and get your request values then set them in your entity
Parameters params = Parameters.instance(); // or @In Parameters parameters if (params!=null) { Map<String, String[]> requestParameters = params.getRequestParameters(); }
-
3. Re: Dynamic form and SEAM
giant2 Oct 24, 2011 10:07 AM (in response to giant2)Thanks for the answer, but what do you mean for
Parameters
?
I check the value inserted on the page (the 2 textfields) in an action which show me only the last value and not both.
Why this appens? -
4. Re: Dynamic form and SEAM
nathandennis Nov 2, 2011 1:59 PM (in response to giant2)he is saying if you are generating a dynamic form and you dont know how many inputs the screen will/could have... maybe you are even trying a recursive form or sorts,,, then use the Parameter Map to get the array of parameters and reference it accordingly.
-
5. Re: Dynamic form and SEAM
giant2 Nov 8, 2011 3:50 AM (in response to giant2)Ok. Infact I have an object @In @Out containig a java.util.List of objects which contain values and label of the textfields I create in the foreach tag.
I try to debug all the app and see the values are correctly set, but for all the textfield after the correct set, a set(blank) is called; only for the last textfield there is only the correct set.
Why this appens, I'm becaming crazy!!! -
6. Re: Dynamic form and SEAM
giant2 Nov 28, 2011 6:32 AM (in response to giant2)Solved myself!
The problem is that foreach reinit the page after the setting and so the values aren't all maintained.
Using ui:repeat all goes ok (without any change to the code).