Hi Rodrigo,
The current implementation of InputButtonSupportTag does not use
'value' attribute for localization.
Here's an excerpt from the official document of the button tag.
-- BEGIN --
The tag will set its value using the first non-null result from the
following list:
resource: {actionFQN}.{buttonName}
resource: {actionPath}.{buttonName} (deprecated)
resource: {buttonName}
the body of the tag
the value attribute of the tag
-- END --
So, you need to use plain HTML tag to override the 'name' attribute
value.
<input type="button" name="listar" value="<fmt:message
key="label.insert" />" />
--
Actually, I think the body of the tag should be checked first.
Then we can easily workaround this problem as follows (without
overhead of localization in Stripes side).
<s:button name="listar"><fmt:message key="label.insert" /></s:button>
Even if you don't need to localize button labels, it still is useful
when you need to display different label for an event.
<s:save name="save">Save Now</s:save>
# I made a similar suggestion for label tag as STS-580, FYI.
Regards,
Iwao
on 09.1.21 11:32 PM Rodrigo Malara said the following:
> Hello,
>
> I'm new to Stripes and building my first web app using it.
> I'm having a bad time configuring localization for it. I'll do my best
> to explain my problem and how things are setup.
> The problem is that I'm getting the stack trace below when using a
> <stripes:button .../> tag on a JSP page. Below is the snippet than the
> stack trace:
>
> <s:form beanclass="xx.com.xxx.xxx.actions.EstadoActionBean">
> <s:button name="listar" value="label.insert" />
> </s:form>
>
> java.util.MissingResourceException: Could not find the form field
> resource bundle needed by Stripes. This almost certainly means that a
> properties file called 'StripesResources.properties' could not be found
> in the classpath. This properties file is needed to lookup form field
> names. Please ensure the file exists in WEB-INF/classes or elsewhere in
> your classpath.
> at java.util.ResourceBundle.throwMissingResourceException(Unknown
> Source)
> at java.util.ResourceBundle.getBundleImpl(Unknown Source)
> at java.util.ResourceBundle.getBundle(Unknown Source)
> at
> net.sourceforge.stripes.localization.DefaultLocalizationBundleFactory.getFormFieldBundle(DefaultLocalizationBundleFactory.java:113)
> at
> net.sourceforge.stripes.localization.LocalizationUtility.getLocalizedFieldName(LocalizationUtility.java:66)
> at
> net.sourceforge.stripes.tag.InputTagSupport.getLocalizedFieldName(InputTagSupport.java:269)
> at
> net.sourceforge.stripes.tag.InputTagSupport.getLocalizedFieldName(InputTagSupport.java:238)
> at
> net.sourceforge.stripes.tag.InputButtonSupportTag.doEndInputTag(InputButtonSupportTag.java:75)
> at
> net.sourceforge.stripes.tag.InputTagSupport.doEndTag(InputTagSupport.java:442)
> at
> org.apache.jsp.WEB_002dINF.jsps.listaEstados_jsp._jspx_meth_s_005fbutton_005f0(listaEstados_jsp.java:249)
> ....
>
> But using JSTL <fmt:message key="label.insert" /> it works fine.
>
> My web.xml file has the following config regarding localization, as
> proposed by Stripes web page:
> <context-param>
> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
> <param-value>StripesResources</param-value>
> </context-param>
>
> And the StripesResources.properties is located at
> WEB-INF/classes/StripesResources.properties
>
> I've Googled around and didn't find anything that could help me out.
> If you have any clue on how I can solve this, I would appreciate.
>
> Thanks
> Rodrigo
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users