struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cliff" <cl...@reinfo.com.hk>
Subject Re: validation issues when using multiple modules
Date Tue, 04 Jan 2005 02:15:01 GMT
Hi,

I havn't use multi-module but multi-config.xml.

My setting of Validator is centralised in one config.xml.

You may try.

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml,
/WEB-INF/validation-lister.xml"/>
</plug-in>


Good Luck.

Cliff

----- Original Message ----- 
From: "Leigh Estes" <lestes@digitalchocolate.com>
To: <user@struts.apache.org>
Sent: Tuesday, January 04, 2005 8:06 AM
Subject: validation issues when using multiple modules


> No one ever responded to my follow up, so I'm trying again:
>
> It is version 1.2.4.
>
> 1) Both modules (root module and submodule) are configured as follows in
> web.xml:
>
> <servlet>
> <servlet-name>action</servlet-name>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>config/lister</param-name>
> <param-value>/WEB-INF/struts-lister-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>debug</param-name>
> <param-value>2</param-value>
> </init-param>
> <init-param>
> <param-name>detail</param-name>
> <param-value>2</param-value>
> </init-param>
> <init-param>
> <param-name>validate</param-name>
> <param-value>true</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> 2) Root module has its message resources and validation configured in
> its struts-config.xml as follows:
>
>     <message-resources parameter="com.dchoc.toblerone.web.Resources"
> null="false"/>
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
> </plug-in>
>
>
> 3) Submodule has its messages resources and validation configured in its
> struts-lister-config.xml as follows:
>
>     <message-resources
> parameter="com.dchoc.toblerone.ext.lister.web.Resources" key=""
> null="false"/>
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml, /WEB-INF/validation-lister.xml"/>
> </plug-in>
>
> Note that null is set to false, and yet no error message appears for the
> key it doesn't seem to be able to find, just an empty string.
>
> 4) In the JSP where the action lives (an action in the submodule that is
> defined in its struts-lister-config.xml) that is configured to do the
> validation in question, html:errors is used as follows.
>
> <html:errors bundle="/lister"/>
>
> Note, in that same JSP, the submodule's bundle is used to print out all
> form labels and buttons with no problem as follows:
>
>           <table class="grid" border="0" cellspacing="2"
> cellpadding="2">
>                 <tr>
>                     <th>
>                         <bean:message bundle="/lister" key="list.name"/>
>                     </th>
>                     <td>
>                         <bean:write name="listView" property="name"/>
>                     </td>
>                 </tr>
>                 <tr>
>                     <th>
>                         <bean:message bundle="/lister" key="list.size"/>
>                     </th>
>                     <td>
>                         <html:text property="size" size="3"
> maxlength="3"/>
>                     </td>
>                 </tr>
>                 <tr height="20"></tr>
>                 <tr>
>                     <td width="80"></td>
>                     <td align="right">
>                         <html:cancel>
>                             <bean:message bundle="/lister"
> key="cancel"/>
>                         </html:cancel>
>                     </td>
>                     <td>
>                         <html:submit>
>                             <bean:message bundle="/lister" key="save"/>
>                         </html:submit>
>                     </td>
>                 </tr>
>               </table>
>
> Note that the list.size key referenced here is the same one referred to
> in the validation.xml that does not show up in the error messages, but
> it shows up just fine on this page when printed out as a form label.
>
> Any help would be most appreciated.
>
> Leigh
>
> On Mon, 2004-12-20 at 16:52, Leigh Estes wrote:
> > From: Niall Pemberton <niall.pemberton@blueyonder.co.uk>
> > Subject: validation issues when using multiple modules
> > Date: Fri, 17 Dec 2004 01:40:09 -0000
> > Content-Type: text/plain;
> > charset="iso-8859-1"
> >
> > When you say Struts 1.2 - is that version 1.2.4?
> >
> > Can you post the relevant bits of config/code:
> >  - show how you have the message resources configured in your
struts-configs
> >  - show how your using <html:errors>
> >
> > Niall
> >
> >
> > ----- Original Message ----- 
> > From: "Leigh Estes" <lestes@digitalchocolate.com>
> > To: <user@struts.apache.org>
> > Sent: Friday, December 17, 2004 12:29 AM
> > Subject: validation issues when using multiple modules
> >
> >
> > > I have configured two modules in my web application using Struts 1.2.
> > > Each has its own struts config as defined in the web application's
> > > web.xml. Each has its own validation XML and resource bundles as
defined
> > > in their respective struts config files.
> > >
> > > The problem I'm seeing is that if I violate a validation rule for the
> > > root module (/), everything works as expected and I see the
appropriate
> > > error message on the page. However, if I violate a validation rule in
> > > the sub module (/app2), the validation works fine except the error
> > > message prints out without the value that should be filled in by the
> > > arg0 element for that field. In other words, instead of 'List size is
> > > required' I see 'is required', where 'List size' is the value for key
> > > 'list.size' that is defined in the resource bundle for module /app2
and
> > > is referenced by the arg0 element for the list size field. I am
> > > referencing the resource bundle for /app2 in the html:errors tag. In
> > > addition, I have tried defining list.size in the root module's
resource
> > > bundle just to verify that the problem isn't that struts is looking
> > > there for it, and that doesn't seem to be the problem because I still
> > > see the same behavior. Has anyone seen anything like this or can
anyone
> > > give me some hints as to what might be going wrong here?
> > >
> > > Thanks,
> > > Leigh
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message