RE: How to pull messages from multiple Bundles?

2003-09-17 Thread Carlos Sánchez
Watch message from Kris Schneider [EMAIL PROTECTED] in "Multiple message
resources with JSTL" thread for an automatic way to do this without having
to modify every jsp page.

> -Mensaje original-
> De: Daniel Wang [mailto:[EMAIL PROTECTED] 
> Enviado el: miércoles, 17 de septiembre de 2003 15:58
> Para: Struts Users Mailing List
> Asunto: Re: How to pull messages from multiple Bundles?
> 
> 
>  & 
> 
> - Original Message - 
> From: "Carlos Sánchez" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Wednesday, September 17, 2003 6:53 AM
> Subject: RE: How to pull messages from multiple Bundles?
> 
> 
> > Another question which I've already asked but nobody answered
> >
> > Is there any way to configure multiple bundles to use with JSTL 
> > fmt:msg
> tag?
> >
> >
> > > -Mensaje original-
> > > De: Thomas Cornet [mailto:[EMAIL PROTECTED]
> > > Enviado el: miércoles, 17 de septiembre de 2003 11:44
> > > Para: Struts Users Mailing List
> > > Asunto: Re: How to pull messages from multiple Bundles?
> > >
> > >
> > > At 00:37 18/09/2003, you wrote:
> > > >Thomas,
> > > >
> > > >Thanks.
> > > >
> > > >This variant that you are referring to is the one that 
> places the 
> > > >errors to the side of the property that causes trouble. Is that 
> > > >right?
> > >
> > > Yep
> > >
> > > >I still want a single view at the top which outlines all the
> > > errors yet
> > > >the message can come from multiple bundles.
> > > >
> > > >Is this achievable?
> > >
> > > I don't think so, because 'bundle' parameter allows only 
> one value. 
> > > I'm afraid you'll have to write your own tag subclassing
> > > ErrorsTag to resolve
> > > your specific problem.
> > >
> > >
> > > Thomas
> > >
> > >
> > >
> > > 
> 
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



RE: How to pull messages from multiple Bundles?

2003-09-17 Thread Carlos Sanchez
Oh, sorry, forget my last post and here's an aswer to your problem (which
was also mine)

Watch this from thread "Multiple message resources with JSTL"



> -Mensaje original-
> De: Kris Schneider [mailto:[EMAIL PROTECTED] 
> Enviado el: viernes, 12 de septiembre de 2003 16:35
> Para: Struts Users Mailing List
> Asunto: Re: Multiple message resources with JSTL
> 
> 
> Here's something that appears to be a step in the right 
> direction. First, use a single context init param for 
> javax.servlet.jsp.jstl.fmt.localizationContext.
> The  content should match the "parameter" 
> attribute of the  element in your default 
> Struts config file. For example, your default Struts config 
> file would include:
> 
> 
> 
> Then, add something like the following to a module Struts config file:
> 
>  parameter="com.obs.webapp.messages.MessagesModule1"/>
> 
> Finally, extend SwitchAction like so:
> 
> import javax.servlet.jsp.jstl.core.Config;
> ...
> public ActionForward execute(ActionMapping mapping,
>  ActionForm form,
>  HttpServletRequest request,
>  HttpServletResponse response) 
> throws Exception {
>   ActionForward forward = super.execute(mapping, form, 
> request, response);
> 
>   ModuleConfig moduleConfig =
> RequestUtils.getModuleConfig(request, 
> getServlet().getServletContext());
> 
>   MessageResourcesConfig messageConfig =
> moduleConfig.findMessageResourcesConfig(Globals.MESSAGES_KEY);
> 
>   if (messageConfig != null) {
> Config.set(request,
>Config.FMT_LOCALIZATION_CONTEXT,
>messageConfig.getParameter());
>   }
> 
>   return forward;
> }
> 
> So, as long as you use the new switch action to move between 
> modules, it should pick up the messages associated with the 
> new module and make them available to JSTL. I haven't looked 
> into how to integrate with module switching via a forward 
> with "contextRelative=true", but there might be something 
> possible there as well...
> 
> Quoting Carlos Sanchez <[EMAIL PROTECTED]>:
> 
> > I'm using JSTL + Struts configured for modules
> > 
> > I'm using JSTL fmt tag for messages, instead of Struts tags, 
> > configured in web.xml
> > 
> >   
> > 
> javax.servlet.jsp.jstl.fmt.localizationContext ram-name>
> > com.obs.webapp.messages.Messages
> >   
> > 
> > I'd like to add more message resources, one for each module.
> > 
> > Adding more context-param's doesn't work, it uses the last one.
> > 
> > Can I configure it in web.xml, have I to use fmt:setBundle in the 
> > jsps, ...?
> 
> -- 
> Kris Schneider 
> D.O.Tech   
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Daniel Wang
 & 

- Original Message - 
From: "Carlos Sánchez" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, September 17, 2003 6:53 AM
Subject: RE: How to pull messages from multiple Bundles?


> Another question which I've already asked but nobody answered
>
> Is there any way to configure multiple bundles to use with JSTL fmt:msg
tag?
>
>
> > -Mensaje original-
> > De: Thomas Cornet [mailto:[EMAIL PROTECTED]
> > Enviado el: miércoles, 17 de septiembre de 2003 11:44
> > Para: Struts Users Mailing List
> > Asunto: Re: How to pull messages from multiple Bundles?
> >
> >
> > At 00:37 18/09/2003, you wrote:
> > >Thomas,
> > >
> > >Thanks.
> > >
> > >This variant that you are referring to is the one that places the
> > >errors
> > >to the side of the property that causes trouble. Is that right?
> >
> > Yep
> >
> > >I still want a single view at the top which outlines all the
> > errors yet
> > >the message can come from multiple bundles.
> > >
> > >Is this achievable?
> >
> > I don't think so, because 'bundle' parameter allows only one
> > value. I'm
> > afraid you'll have to write your own tag subclassing
> > ErrorsTag to resolve
> > your specific problem.
> >
> >
> > Thomas
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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



RE: How to pull messages from multiple Bundles?

2003-09-17 Thread Carlos Sánchez
Another question which I've already asked but nobody answered

Is there any way to configure multiple bundles to use with JSTL fmt:msg tag?


> -Mensaje original-
> De: Thomas Cornet [mailto:[EMAIL PROTECTED] 
> Enviado el: miércoles, 17 de septiembre de 2003 11:44
> Para: Struts Users Mailing List
> Asunto: Re: How to pull messages from multiple Bundles?
> 
> 
> At 00:37 18/09/2003, you wrote:
> >Thomas,
> >
> >Thanks.
> >
> >This variant that you are referring to is the one that places the 
> >errors
> >to the side of the property that causes trouble. Is that right?
> 
> Yep
> 
> >I still want a single view at the top which outlines all the 
> errors yet
> >the message can come from multiple bundles.
> >
> >Is this achievable?
> 
> I don't think so, because 'bundle' parameter allows only one 
> value. I'm 
> afraid you'll have to write your own tag subclassing 
> ErrorsTag to resolve 
> your specific problem.
> 
> 
> Thomas 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



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



Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Daniel Wang
They are the same tablib, i.e.  or  and you can
only specify one optional bundle with each of these tags.

If you really want to implement this, you can subclass or modify
ActionMessage to allow you to specify a message bundle, and subclass
ErrorsTag to use the specified bundle with each message.  It should actually
be pretty easy, probably only 10-20 lines of code.

daniel

"manglu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas,
>
> Thanks.
>
> This variant that you are referring to is the one that places the errors
> to the side of the property that causes trouble. Is that right?
>
> I still want a single view at the top which outlines all the errors yet
> the message can come from multiple bundles.
>
> Is this achievable?
>
> Manglu
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Thomas Cornet
At 00:37 18/09/2003, you wrote:
Thomas,

Thanks.

This variant that you are referring to is the one that places the errors 
to the side of the property that causes trouble. Is that right?
Yep

I still want a single view at the top which outlines all the errors yet 
the message can come from multiple bundles.

Is this achievable?
I don't think so, because 'bundle' parameter allows only one value. I'm 
afraid you'll have to write your own tag subclassing ErrorsTag to resolve 
your specific problem.

Thomas 



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


Re: How to pull messages from multiple Bundles?

2003-09-17 Thread manglu
Thomas,

Thanks.

This variant that you are referring to is the one that places the errors 
to the side of the property that causes trouble. Is that right?

I still want a single view at the top which outlines all the errors yet 
the message can come from multiple bundles.

Is this achievable?

Manglu



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


Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Daniel Wang
I don't believe you can.
 or  can only accept a single message bundle.

daniel

"manglu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thomas,
>
> You didn't get the question.
>
> I understand that multiple bundles can be used in bean:write or other
> tags that understand i18n.
>
> Question is:
>
> Application identifies two errors-
> errors.invalid (found in bundle1)
>
> invalid.amount (found in bundle2)
>
> When i create these errors and add it to the request scope how do i tell
> it which bundle do these keys exist in?
>
> If i say html:errors to display my errors how would it know that one of
> the error keys is from bundle1 while the other is from bundle2?
>
> Hope that clarifies the question
>
> Manglu
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Thomas Cornet
Oh, excuse me. Looking at the DTDs, it seems that  tag has a 
'bundle' parameter, so something like  :



This should search errors message in the right message ressource, if they 
are all in the same.

Thomas

PS : ActionError class just stores the key, which is only processed by 
html:errors during page generation

At 23:54 17/09/2003, you wrote:
Thomas,

You didn't get the question.

I understand that multiple bundles can be used in bean:write or other tags 
that understand i18n.

Question is:

Application identifies two errors-
errors.invalid (found in bundle1)
invalid.amount (found in bundle2)

When i create these errors and add it to the request scope how do i tell 
it which bundle do these keys exist in?

If i say html:errors to display my errors how would it know that one of 
the error keys is from bundle1 while the other is from bundle2?

Hope that clarifies the question

Manglu



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


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


Re: How to pull messages from multiple Bundles?

2003-09-17 Thread manglu
Thomas,

You didn't get the question.

I understand that multiple bundles can be used in bean:write or other 
tags that understand i18n.

Question is:

Application identifies two errors-
errors.invalid (found in bundle1)
invalid.amount (found in bundle2)

When i create these errors and add it to the request scope how do i tell 
it which bundle do these keys exist in?

If i say html:errors to display my errors how would it know that one of 
the error keys is from bundle1 while the other is from bundle2?

Hope that clarifies the question

Manglu



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


Re: How to pull messages from multiple Bundles?

2003-09-17 Thread [EMAIL PROTECTED]
I asked virtually the same question yesterday and got a similar answer.

Unfortunately this seems to imply that the jsp has to know about how you
arrange your message files which is disappointing.

- Original Message - 
From: "Thomas Cornet" <[EMAIL PROTECTED]>
Newsgroups: Struts
Sent: Wednesday, September 17, 2003 8:04 AM
Subject: Re: How to pull messages from multiple Bundles?


>
>I'm doing the same thing on my current webapp. You can define as many
> ressources as you want in your struts-config.xml. Let's define two
> ressources in your struts-config.xml kile this (the bundle attribute
allows
> to identify ressources)
>
>  
>   parameter="package.ressources.buttons" />
>  
>  
>
> and one in your struts-config-module.xml
>
>  
>
> Then, in your module page :
>
> a) doing  will search the property in
> 'package/module/ressources/default.properties'
> b) doing  will get the
> message from 'package/ressources/errors/properties'
>
>Conclusion : you can split all your general messages into several
> message-ressources in your struts-config.xml, and each bundle will
> be accessible from any module.
>
> HTH,
>
> Thomas
>
>
> At 18:14 17/09/2003, you wrote:
> >Hi,
> >I want to seperate my message bundle into multiple bundles instead of
just
> >using one big block.
> >(For eg)
> >
> >GenericMessages
> >error.invalid={0} contians invalid data.
> >
> >Module1Messages
> >invalid.amount={0} must be atleast 5.
> >
> >I do my validation by myself (not using the Validator) So the application
> >component that identifies these errors creates action errors like:
> >ActionError e= new ActionError("error.invalid", "arg1");
> >
> >and then add the ActionErrors to the request scope
> >and they are displayed via  tag
> >
> >Now if all the keys comes from the same bundle it is not a problem. If i
> >want to display both the messages
> >"error.invalid" & "invalid.amount" how would i do that?
> >
> >
> >Appreciate any help
> >
> >Manglu
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]

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



Re: How to pull messages from multiple Bundles?

2003-09-17 Thread Thomas Cornet
  I'm doing the same thing on my current webapp. You can define as many 
ressources as you want in your struts-config.xml. Let's define two 
ressources in your struts-config.xml kile this (the bundle attribute allows 
to identify ressources)






and one in your struts-config-module.xml



Then, in your module page :

a) doing  will search the property in 
'package/module/ressources/default.properties'
b) doing  will get the 
message from 'package/ressources/errors/properties'

  Conclusion : you can split all your general messages into several 
message-ressources in your struts-config.xml, and each bundle will
be accessible from any module.

HTH,

Thomas

At 18:14 17/09/2003, you wrote:
Hi,
I want to seperate my message bundle into multiple bundles instead of just 
using one big block.
(For eg)

GenericMessages
error.invalid={0} contians invalid data.
Module1Messages
invalid.amount={0} must be atleast 5.
I do my validation by myself (not using the Validator) So the application 
component that identifies these errors creates action errors like:
ActionError e= new ActionError("error.invalid", "arg1");

and then add the ActionErrors to the request scope
and they are displayed via  tag
Now if all the keys comes from the same bundle it is not a problem. If i 
want to display both the messages
"error.invalid" & "invalid.amount" how would i do that?

Appreciate any help

Manglu



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


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