[
http://www.stripesframework.org/jira/browse/STS-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11327#action_11327
]
Gregg Bolinger commented on STS-543:
------------------------------------
HTML standards is only an oxymoron between browsers. There really is an HTML
standard. I think the fact that s:label works outside a form tag should be the
bug. :) <label /> elements aren't for displaying static (localized) text.
They are specifically designed to be using along side FORM controls. Stripes
shouldn't allow invalid HTML regardless of whether or not the browser complains
about it.
Again, there is a perfectly good alternative that doesn't break HTML.
<fmt:bundle basename="StripesResources" />
<fmt:message key="FQN.key" />
> s:label tag does not use Action Bean FQN when outside of s:form
> ---------------------------------------------------------------
>
> Key: STS-543
> URL: http://www.stripesframework.org/jira/browse/STS-543
> Project: Stripes
> Issue Type: Bug
> Components: Tag Library
> Affects Versions: Release 1.5
> Environment: Stripes SVN build 883
> Reporter: Frederic Daoud
>
> The s:label tag can be used outside of the s:form tag to benefit from its
> localization functionality.
> My use case is displaying information in a label-field manner much like a
> form, but in a read-only page. So in this case there is no form. But the
> labels are the same as in the corresponding form page, so it'd be nice to use
> the same s:label tags.
> The problem is that I want to use FQN.name keys in the resource bundle, but
> the s:label tag uses the FQN only if there is a parent form tag.
> I suggest the same solution as the s:errors tag. That is, the s:errors tag
> also works outside of a form tag, and uses the current Action Bean in that
> case. So the s:label tag could also use the FQN of the current Action Bean
> for resource bundle key lookup.
> Here is a proposed patch against SVN build 883. Basically it uses the current
> Action Bean if the form is null. I hesitate because this is in
> InputTagSupport so affects several other tags. This can be a good thing or a
> bad thing....does this code belong here or only in the InputLabelTag? Your
> opinion would be much appreciated.
> Index: stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
> ===================================================================
> --- stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
> (revision 883)
> +++ stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
> (working copy)
> @@ -16,6 +16,7 @@
>
> import net.sourceforge.stripes.action.ActionBean;
> import net.sourceforge.stripes.controller.ParameterName;
> +import net.sourceforge.stripes.controller.StripesConstants;
> import net.sourceforge.stripes.controller.StripesFilter;
> import net.sourceforge.stripes.exception.StripesJspException;
> import net.sourceforge.stripes.exception.StripesRuntimeException;
> @@ -250,11 +251,20 @@
> try { form = getParentFormTag(); }
> catch (StripesJspException sje) { /* Do nothing. */}
>
> - return LocalizationUtility.getLocalizedFieldName(name,
> - form == null ? null
> : form.getAction(),
> - form == null ? null
> : form.getActionBeanClass(),
> - locale);
> + String actionPath = null;
> + Class<? extends ActionBean> beanClass = null;
>
> + if (form != null) {
> + actionPath = form.getAction();
> + beanClass = form.getActionBeanClass();
> + }
> + else {
> + ActionBean mainBean = (ActionBean)
> getPageContext().getRequest().getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN);
> + if (mainBean != null) {
> + beanClass = mainBean.getClass();
> + }
> + }
> + return LocalizationUtility.getLocalizedFieldName(name, actionPath,
> beanClass, locale);
> }
>
> protected ValidationMetadata getValidationMetadata() throws
> StripesJspException {
> Thanks,
> Freddy
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development