ojay78 wrote the following on 9/22/2005 1:22 PM:
On my showFVKNAdminAction I receive a value from the previous ActionForm
and put it in the request so that the next handleFVKNAction have this value.
I also put a attribute in the request so that the handleFVKNAction knows
that it has to act like a “show” action not like a “update” action. Then
I get the my values that are relevant for me out of the database. I put
this List into my Viewmodel and the handleFVKNForm. Then I forward to
the jsp.
If it's just a show action, I wouldn't put the List into the form. Since
you only need this list for display purposes put it into the Request.
In the JSP I get my Viewmodell and show my values on my page with the
logic:iterate tag
<bean:define id="fvknList" ...<snip>
You shouldn't need to use bean:define at all. The list is put in request
scope in your action before you get to the JSP, so you don't need the above.
html:form action="/handleFVKNAction" method="post" >
<logic:iterate name="fvknList" id="line" indexId="lineNo"
type="FVKN">
<tr>
<td><%=lineNo.intValue()+1%></td>
<td><bean:write name="line"
property="fieldName" filter="true" /></td>
This works so far.
But when I hit the submit button the handleFVKNForm is empty. Why is
that so?
What I want is to get my List from the database, display it on the jsp
page and if the submit button will be pressed it should update this list
in my database.
I'm not sure exactly what you mean by the above. If you do want the
whole List submited when you submit the form, then yes you will need to
put the List into the form bean as a property. In that case, I'm not
sure what exactly you are tyring to capture and update? You only showed
<bean:write name="line" property="fieldName" filter="true" /> which is
display only. Are you wanting to update all the fields in the table (the
List) and then have that updated list available when you submit? If so
this can be done, but I'm just not sure that's even what you are trying
to do.
I think my failure is, that this fvknList is from my Viewmodel but I
should get it from my prepopulated form bean, right? But obviously I
don’t know how to do that
You'd have your formBean have a property: List fvknList; with set/get
methods. You'll run into a few quirks when you try to submit the form if
the form doesn't have session scope. We can address those later when
you want the form with request scope, but for now to get it working,
give the form session scope and add the List as a property of your form
bean.
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]