Re: JSTL messages problem
Place this in your web.xml file: context-param param-namejavax.servlet.jsp.jstl.fmt.localizationContext/param-name param-valuecom.omnytext.blah.blah.properties.ApplicationResources /param-value /context-param Where ApplicationResources.properties is the name of the message bundle in question. - Nick On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Hello... I'm trying to display messages from a bundle using JSTL like so: fmt:message key=messages.appTitle / This isn't working, I'm getting: ???messages.appTitle??? However, doing: bean:message key=messages.appTitle/ Working fine. So I know the key is correct, and the bundle is being read, etc. I admit I haven't done much with JSTL, but this seems pretty simple. Do I need to do any other kind of setup to tell the JSTL tags about the bundle? Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
Hi Nick, I added this but it still didn't work... One thing that didn't make sense to me is that I have app_resources_en.properties in WEB-INF/classes, so I wasn't sure how to qualify that in a package structure, so I just put param-valueapp_resources.properties/param-value... is that right or am I misunderstanding something? Thanks again! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:02 pm, Nick Sophinos said: Place this in your web.xml file: context-param param-namejavax.servlet.jsp.jstl.fmt.localizationContext/param-name param-valuecom.omnytext.blah.blah.properties.ApplicationResources /param-value /context-param Where ApplicationResources.properties is the name of the message bundle in question. - Nick On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Hello... I'm trying to display messages from a bundle using JSTL like so: fmt:message key=messages.appTitle / This isn't working, I'm getting: ???messages.appTitle??? However, doing: bean:message key=messages.appTitle/ Working fine. So I know the key is correct, and the bundle is being read, etc. I admit I haven't done much with JSTL, but this seems pretty simple. Do I need to do any other kind of setup to tell the JSTL tags about the bundle? Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [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: JSTL messages problem
Ah, I got it! The parameter should have been app_resources WITHOUT the .properties. Now it works. Thanks Nick, I appreciate your time! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:20 pm, Frank W. Zammetti said: Hi Nick, I added this but it still didn't work... One thing that didn't make sense to me is that I have app_resources_en.properties in WEB-INF/classes, so I wasn't sure how to qualify that in a package structure, so I just put param-valueapp_resources.properties/param-value... is that right or am I misunderstanding something? Thanks again! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:02 pm, Nick Sophinos said: Place this in your web.xml file: context-param param-namejavax.servlet.jsp.jstl.fmt.localizationContext/param-name param-valuecom.omnytext.blah.blah.properties.ApplicationResources /param-value /context-param Where ApplicationResources.properties is the name of the message bundle in question. - Nick On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Hello... I'm trying to display messages from a bundle using JSTL like so: fmt:message key=messages.appTitle / This isn't working, I'm getting: ???messages.appTitle??? However, doing: bean:message key=messages.appTitle/ Working fine. So I know the key is correct, and the bundle is being read, etc. I admit I haven't done much with JSTL, but this seems pretty simple. Do I need to do any other kind of setup to tell the JSTL tags about the bundle? Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [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: JSTL messages problem
Yep, just figured that out myself :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:27 pm, Wendy Smoak said: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: I added this but it still didn't work... One thing that didn't make sense to me is that I have app_resources_en.properties in WEB-INF/classes, so I wasn't sure how to qualify that in a package structure, so I just put param-valueapp_resources.properties/param-value... is that right or am I misunderstanding something? Thanks again! Leave off the '.properties' in the param-value. Other than that, yes. -- Wendy http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsMessagesAndJSTL - 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: JSTL messages problem
Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / I get... org.apache.jasper.JasperException: /index.jsp(36,83) equal symbol expected ...when I try it. bean:message doesn't work either... it's obviously a problem with embedding one taq in another, so I guess my quesion really is how does one label a submit button with a message from a bundle in general? I've done this in the past, but I've never tried it from within an html:submit, always a plain HTML input element, so it wasn't a nested custom tag. Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:27 pm, Wendy Smoak said: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: I added this but it still didn't work... One thing that didn't make sense to me is that I have app_resources_en.properties in WEB-INF/classes, so I wasn't sure how to qualify that in a package structure, so I just put param-valueapp_resources.properties/param-value... is that right or am I misunderstanding something? Thanks again! Leave off the '.properties' in the param-value. Other than that, yes. -- Wendy http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsMessagesAndJSTL - 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: JSTL messages problem
On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. -ed On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - 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: JSTL messages problem
On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? snip/ fmt:message has a var/scope tuple for this purpose. -Rahul Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
On 11/22/05, Ed Griebel [EMAIL PROTECTED] wrote: I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. What he said. :) I had to go look around the source code of an old project to refresh my memory and was about to post a similar example. Too much BASIC, not enough Java, lately... -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
I admit I always forget the button and submit elements, among others, support body text. Had I remembered that I would have come up with this on my own :) But thanks Ed (and Wendy after the fact ;) ), that worked perfectly. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 4:21 pm, Ed Griebel said: I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. -ed On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - 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: JSTL messages problem
On 11/22/05, Rahul Akolkar [EMAIL PROTECTED] wrote: On 11/22/05, Nick Sophinos [EMAIL PROTECTED] wrote: This is definitely not how JSTL recommends loading bundles (see fmt:bundle and fmt:setBundle). Ofcourse, its your decision. Can you explain more about this? I'm also using the context parameter, and I only have the one .properties file, the app has no need for i18n. It looks like fmt:setBundle would be done on each page, so I'm not sure what I'd gain from it. Thanks, -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
Unfortunately I tried that... as Wendy said, the problem ultinately is really one tag nested within another. Frank Garner, Shawn wrote: It might also work to do this: html:submit styleClass=cssButton value=fmt:message key='labels.loginButton' / / Sometimes double quotes inside double quotes confuses the compiler. If you put single quotes inside the double quotes it might be able to better determine your meaning. Shawn -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 22, 2005 2:43 PM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: Re: JSTL messages problem Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / I get... org.apache.jasper.JasperException: /index.jsp(36,83) equal symbol expected ...when I try it. bean:message doesn't work either... it's obviously a problem with embedding one taq in another, so I guess my quesion really is how does one label a submit button with a message from a bundle in general? I've done this in the past, but I've never tried it from within an html:submit, always a plain HTML input element, so it wasn't a nested custom tag. Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Rahul Akolkar [EMAIL PROTECTED] wrote: On 11/22/05, Nick Sophinos [EMAIL PROTECTED] wrote: This is definitely not how JSTL recommends loading bundles (see fmt:bundle and fmt:setBundle). Ofcourse, its your decision. Can you explain more about this? snip/ Ofcourse. I think Frank also asked a similar question, though the top posting in that email might have thrown me off. I'm also using the context parameter, and I only have the one .properties file, the app has no need for i18n. snap/ It boils down to what a technology *expects* the casual users to know. The param-name is merely an implementation detail (though the spec talks about it so its guaranteed to be the same name in all JSTL impls). Its similar to the casual user not needing to know that a Struts module is loaded under the attribute name Globals.MODULE_KEY + prefix. In addition, as you've noted, this approach mandates the app use a single basename bundle. It looks like fmt:setBundle would be done on each page, so I'm not sure what I'd gain from it. snip/ Why on every page? -Rahul Thanks, -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
On 11/22/05, Garner, Shawn [EMAIL PROTECTED] wrote: It might also work to do this: html:submit styleClass=cssButton value=fmt:message key='labels.loginButton' / / Sometimes double quotes inside double quotes confuses the compiler. If you put single quotes inside the double quotes it might be able to better determine your meaning. snip/ I wouldn't recommend that. I suspect the only thing we might end up confusing is ourselves ;-) -Rahul Shawn -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 22, 2005 2:43 PM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: Re: JSTL messages problem Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / I get... org.apache.jasper.JasperException: /index.jsp(36,83) equal symbol expected ...when I try it. bean:message doesn't work either... it's obviously a problem with embedding one taq in another, so I guess my quesion really is how does one label a submit button with a message from a bundle in general? I've done this in the past, but I've never tried it from within an html:submit, always a plain HTML input element, so it wasn't a nested custom tag. Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 22, 2005 3:27 pm, Wendy Smoak said: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: I added this but it still didn't work... One thing that didn't make sense to me is that I have app_resources_en.properties in WEB-INF/classes, so I wasn't sure how to qualify that in a package structure, so I just put param-valueapp_resources.properties/param-value... is that right or am I misunderstanding something? Thanks again! Leave off the '.properties' in the param-value. Other than that, yes. -- Wendy http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsMessagesAndJSTL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
For the record, here's the general solution as well, for situations where you can't use the element body like that. First, defining a scripting variable: c:set var=msgfmt:message key=msg.key//c:set x:yyy ... attr=${msg}/ Or, to avoid the scripting variable, you can use jsp:attribute: c:yyy ... jsp:attribute name=attr fmt:message key=msg.key/ /jsp:attribute /c:yyy This comes up on the list so often, I think I'll add an FAQ page to the wiki :-) L. Ed Griebel wrote: I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. -ed On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - 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: JSTL messages problem
On 11/22/05, Laurie Harper [EMAIL PROTECTED] wrote: For the record, here's the general solution as well, for situations where you can't use the element body like that. First, defining a scripting variable: c:set var=msgfmt:message key=msg.key//c:set snip/ http://marc.theaimsgroup.com/?l=struts-userm=113269509808314w=2 -Rahul x:yyy ... attr=${msg}/ Or, to avoid the scripting variable, you can use jsp:attribute: c:yyy ... jsp:attribute name=attr fmt:message key=msg.key/ /jsp:attribute /c:yyy This comes up on the list so often, I think I'll add an FAQ page to the wiki :-) L. Ed Griebel wrote: I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. -ed On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL messages problem
Well, I said this was the gereral solution ;-) But yes, I forgot about that, which makes things that bit simpler for this case. L. Rahul Akolkar wrote: On 11/22/05, Laurie Harper [EMAIL PROTECTED] wrote: For the record, here's the general solution as well, for situations where you can't use the element body like that. First, defining a scripting variable: c:set var=msgfmt:message key=msg.key//c:set snip/ http://marc.theaimsgroup.com/?l=struts-userm=113269509808314w=2 -Rahul x:yyy ... attr=${msg}/ Or, to avoid the scripting variable, you can use jsp:attribute: c:yyy ... jsp:attribute name=attr fmt:message key=msg.key/ /jsp:attribute /c:yyy This comes up on the list so often, I think I'll add an FAQ page to the wiki :-) L. Ed Griebel wrote: I use this idiom all the time to get a message label on a button: html:submit property=button styleClass=longButton bean:message key=button.confirm/ /html:submit You should be able to substitute fmt:message above. -ed On 11/22/05, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/22/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: Ok, today is apparently the day I get to ask a bunch of stupid questions... Why doesn't this work? html:submit styleClass=cssButton value=fmt:message key=labels.loginButton / / You can't use a JSP tag as attribute of another JSP tag. Maybe try c:set with the fmt in the body, then use an expression for the value of html:submit? Which implies the use of the Struts-EL taglib, which you should be using if you're on Servlet 2.3/JSTL 1.0. If you haven't already, change the URI in %@ taglib and leave the prefix as 'html'. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]