Struts stores a MessageResources object in the ServletContext under the Globals.MessagesKey. You can grab it from there or use ResourceBundle.getBundle(). See the javadoc for more details.

David






From: "Jana Navaneethan" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
CC: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: Help with Multiple Input!
Date: Wed, 4 Dec 2002 15:12:40 -0500

Hi,
Thanks for your valuable suggestion. It solved my problem. I have a
basic question, How can I retrieve messages from my properties file in my
form bean? I need to do this for some checkbox labels and values I want to
use the messages from the ApplicationResources.properties file.

Your help will be greatly appreciated!

Thanks,
Jana.



----- Original Message -----
From: "Sri Sankaran" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 3:03 PM
Subject: RE: Help with Multiple Input!


>
>
> > -----Original Message-----
> > From: Jana Navaneethan [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 03, 2002 2:57 PM
> > To: [EMAIL PROTECTED]
> > Cc: Struts Users Mailing List
> > Subject: Re: Help with Multiple Input!
> >
> >
> > Hi Wendy,
> > All I am trying to do is to avoid repeating
> > the HTML code. I am trying to do something like
> > <html:checkbox property="dayFlag<%= i %>"/> where i is an
> > integer 1 thru 7 and in my form bean I will have getter like
> > getDayFlag1(), etc. Now the problem is with the static text
> > ie Monday which should be displayed from the message
> > resources, I dont know how to do that? I am trying some thing
> > like <bean:message key="businesslisting.message5<%= i %>"/>
> > which is not working, Could you please tell me any work
> > around for this?
> >
>
> Just answering your current question, you cannot specify a tag attribute
with a combination of a literal and a JSP expression. That is,
>
> <bean:message key="foo<%=bar%>"/>
>
> is a no-no. Instead code it as
>
> <bean:message key='<%="foo"+bar%>'/>
>
> So, your specific example would look like
>
> <bean:message key='<%="businesslisting.message5" + i %>'/>
>
> > Thanks,
> > Jana.
>
> Sri
> >
> > ----- Original Message -----
> > From: "Wendy Smoak" <[EMAIL PROTECTED]>
> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > Sent: Tuesday, December 03, 2002 2:36 PM
> > Subject: RE: Help with Multiple Input!
> >
> >
> > > > I have a form in which I am collecting multiple input
> > from the user,
> > > > for example for each day of the week I am collecting opening hour
> > > > and closing hour something in the format of day - checkbox -
> > > > select/option - select/option , I want to do this in
> > a
> > > > loop for all 7 days of the week. I couldn't find any good
> > examples
> > > > or tutorials for this. Please let me know the right way of doing
> > > > this or
> > any
> > > > sample would be greatly appreciated!
> > >
> > > JMO, but since this is a fixed number of form fields, I
> > wouldn't try
> > > to do
> > a
> > > loop to present them, just name them 'monday' 'mondayOpen' and
> > > 'mondayClose', etc.
> > >
> > > Only the successful (checked) checkboxes will be present in the
> > > request,
> > so
> > > you can check for the existence of each one, and if it's
> > there, then
> > > go
> > look
> > > for the open/close fields.
> > >
> > > I'm sure it could be done more elegantly, but I think you might be
> > > making
> > it
> > > more complicated than it has to be. Loops are good when
> > you have no
> > > idea how many rows you'll need to present, or if there are
> > many items.
> > >
> > > --
> > > Wendy Smoak
> > > Applications Systems Analyst, Sr.
> > > Arizona State University PA Information Resources Management
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-> [EMAIL PROTECTED]>
> > For
> > additional commands,
> > e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


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

Reply via email to