[Opensource] Question on MessageBundles and Struts validation

Wise, Malcolm Malcolm.Wise at eu.sony.com
Wed Nov 12 00:33:22 PST 2003


Eddie,

For message bundles, you can also use the <c:fmt> JSTL tags, e.g.

<fmt:setBundle basename="com.cal.cp.MessageBundle"/>
...
...
<fmt:message key="message.key"/>

or, if you're using multiple bundles in a single page, you can wrap the
<fmt:message> tag like so:

<fmt:bundle basename="com.cal.cp.MessageBundle">
  <fmt:message key="message.key"/>
</fmt:bundle>

Using JSTL means that you don't need to specify message bundles in the
struts-config.xml.  Also, you can specify a default message bundle for JSTL
(e.g. Struts ApplicationResources) in web.xml (assumes ApplicationResources
is in WEB-INF\classes):

<context-param>
  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  <param-value>ApplicationResources</param-value>
</context-param>

Doing this means you don't need the <fmt:setBundle> tag.

HTH,
Malc 

-----Original Message-----
From: Michael Rimov [mailto:rimovm at centercomp.com]
Sent: 11 November 2003 21:53
To: opensource at jcorporate.com
Subject: Re: [Opensource] Question on MessageBundles and Struts
validation


At 08:55 PM 11/10/2003, you wrote:
>1. Does expresso support additional message bundles?
>
>Have added to application specific struts-config.xml e.g.
>  <message-resources null="false" parameter="com.cal.cp.MessagesBundle" 
> key="alternate"/>
>
>How would I access this bundle through expresso? Or do I have to go 
>through struts.

Eddie,

I believe you want to use the Struts tags on that one.


>2. Does expresso support apache commons validator found in struts 1.1, 
>i.e. the ValidatorForm or DynaValidatorForm with declarative validation. 
>Haven't been able to find any samples of this.


Good question!  :)  Expresso has no problem working with Struts form beans, 
so I've seen no reason why Validator can't work with Expresso as well.  I 
haven't tried it, but AFAICT there's no obstructions to making it 
work.  The only difference would be error handling, but I believe that 
could be picked up in the controller's state.

I just haven't been able to get to giving it a spin myself.

                                                         -Mike




_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/


***********************************************************************************************
The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only. 

This email and any response may be monitored by Sony United Kingdom Limited.
(04)
***********************************************************************************************




More information about the Opensource mailing list