I'm fighting to find a clean solution to the following problem and hope that
the experts out there can provide

Context:

- File upload size limit set via the struts controller
- DynaValidatorForm with properties (id, dispatch, file)
- CRUD action create/read/update/delete via DispatchAction
   - create/update obviouslly use the form properties
   - read/delete only need a query parameter id
- object.jsp retrieve the current value (read) of the object and propose the
form to create/update the object
- validation xml set 'file'  to requiredwhen dispatch == select and dispatch
== create

object.jsp is something like this:

----------------- object.jsp --------------
<c:if test="${not empty param.id}">
  <c:set var="id" value="param.id" scope="page"/>
</c:if>
<c:if test="${not empty myform.map.id}">
  <c:set var="id" value="myform.map.id" scope="page"/>
</c:if>

<html:form action="object.do" enctype="multipart/form-data">
<html:img page="/object.do?dispatch=select&id=${id}"/>
<html:hidden property="id" value="${id}"/>
<html:hidden property="dispatch"/>
<html:file property="file" accept="image/jpeg"/>
<html:submit/>
</html:form>

Not that in case of create/update success, it is forwarded to this page
again.

I imagine it is not correct at all considering my zero experience with
Struts, but I'd be glad if someone could give me an idea of how to do
something cleaner than this absoltely ugly code. My problem is mostly to
deal with the fact that I need to retrieve the id both in the request and
the form, but I'm not satisfied with the above.

Thanks a lot for any help.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to