struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Bailliez" <>
Subject DispatchAction / DynaValidatorForm / Upload best practice
Date Sun, 18 Apr 2004 20:45:51 GMT
I'm fighting to find a clean solution to the following problem and hope that
the experts out there can provide


- 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}">
  <c:set var="id" value="" scope="page"/>
<c:if test="${not empty}">
  <c:set var="id" value="" scope="page"/>

<html:form action="" enctype="multipart/form-data">
<html:img page="/${id}"/>
<html:hidden property="id" value="${id}"/>
<html:hidden property="dispatch"/>
<html:file property="file" accept="image/jpeg"/>

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

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:
For additional commands, e-mail:

View raw message