[
http://www.stripesframework.org/jira/browse/STS-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11416#action_11416
]
Frederic Daoud commented on STS-543:
------------------------------------
By the way, using label elements outside of a form tag is valid according to
the HTML 4.01 Strict specification.
> 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
> Assignee: Frederic Daoud
> Fix For: Release 1.5
>
>
> 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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development