Skip to content

Added <spring:argument> subtag for message/theme #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

beamerblvd
Copy link
Contributor

Added a new <spring:argument> tag meant for nesting within
<spring:message> and <spring:theme>. The tag is based on the
<fmt:param> tag and uses conventions found throughout other Spring tags.
Ten new unit tests and over a dozen changed unit tests accompany the
changes, which are detailed below.

Itemized Changes:

  • Incremented version number of tag libraries to 4.0.
  • Added <spring:argument> tag to spring.tld.
  • Updated documentation for message and theme tags in spring.tld.
  • Added o.s.web.servlet.tags.ArgumentTag class to handle tag. Added 5
    unit tests to test behavior.
  • Added o.s.web.servlet.tags.ArgumentAware to mark tags supporting
    arguments.
  • Updated o.s.web.servlet.tags.MessageTag to implement ArgumentAware
    and permit either nested argument tags or the arguments attribute, but
    not both. Also updated JavaDoc. Added three unit tests to test behavior.
    Updated over a dozen other unit tests to test behavior.
  • Updated o.s.web.servlet.tags.ThemeTag JavaDoc.
  • Fixed an @link error in the JavaDoc for o.s.web.servlet.tags.UrlTag
  • o.s.web.servlet.tags.ParamTag was susceptible to problems in
    containers that pool tags. It wasn't resetting values when the
    release method was called, so if a user used multiple <spring:param>
    tags and mixed using the value attribute and tag body, it's possible
    that the value used might not be correct. This would be very
    difficult to duplicate. I just noticed it while making the similar
    ArgumentTag and decided it should be fixed while I was in there.
    I also added two additional unit tests to test this behavior change.

Issue: SPR-9678

Added a new <spring:argument> tag meant for nesting within
<spring:message> and <spring:theme>. The tag is based on the
<fmt:param> tag and uses conventions found throughout other Spring tags.
Ten new unit tests and over a dozen changed unit tests accompany the
changes, which are detailed below.

Itemized Changes:
 - Incremented version number of tag libraries to 4.0.
 - Added <spring:argument> tag to spring.tld.
 - Updated documentation for message and theme tags in spring.tld.
 - Added o.s.web.servlet.tags.ArgumentTag class to handle tag. Added 5
   unit tests to test behavior.
 - Added o.s.web.servlet.tags.ArgumentAware to mark tags supporting
   arguments.
 - Updated o.s.web.servlet.tags.MessageTag to implement ArgumentAware
   and permit either nested argument tags or the arguments attribute, but
   not both. Also updated JavaDoc. Added three unit tests to test behavior.
   Updated over a dozen other unit tests to test behavior.
 - Updated o.s.web.servlet.tags.ThemeTag JavaDoc.
 - Fixed an @link error in the JavaDoc for o.s.web.servlet.tags.UrlTag
 - o.s.web.servlet.tags.ParamTag was susceptible to problems in
   containers that pool tags. It wasn't resetting values when the
   release method was called, so if a user used multiple spring:param
   tags and mixed using the value attribute and tag body, it's possible
   that the value used might not be correct. This would be very
   difficult to duplicate. I just noticed it while making the similar
   ArgumentTag and decided it should be fixed while I was in there.
   I also added two additional unit tests to test this behavior change.

Issue: SPR-9678
@beamerblvd
Copy link
Contributor Author

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

@beamerblvd
Copy link
Contributor Author

Has anyone had a chance to look at this simply change? I'd love to get this in before 4.0.M2.

@beamerblvd
Copy link
Contributor Author

*simple change

@beamerblvd
Copy link
Contributor Author

I posted this pull request nearly six weeks ago. I understand that some back-and-forth and revisions may be necessary before it can be approved. However, is six weeks I haven't received a single comment. The back-and-forth and revisions can't happen if I don't get any feedback. Can someone please look at this? I don't want it to sit there for so long that it's no longer mergable, and I really wanted it to be merged for Milestone 2.

@beamerblvd
Copy link
Contributor Author

I assume from the lack of comments after nearly seven weeks that this pull request is perfect :) ... can someone please merge it so that it will be part of Milestone 2?

@philwebb
Copy link
Member

I started looking at this yesterday, from what I can tell it pretty much is perfect :) M2 has been pushed back a couple of days so that we can get to a few issues like this one.

The one change I was thinking of making was to allow the argument tags and the comma values to be used together, rather than either/or.

@beamerblvd
Copy link
Contributor Author

Thanks!

As for your thoughts on allowing argument tags and comma values to be used together, I don't see how that can work. Unlike the <spring:param>, which consist of a key and a value, arguments for a message are just a value and must be specified in the order they are numbered in the message. Consider this:

<spring:message code="my.message.code" arguments="15.25,World">
    <spring:argument value="8.6" />
    <spring:argument>This is another argument</spring:argument>
</spring:message>

Which argument is argument number 1? 2? 3? 4? IMO, this doesn't work and is extremely confusing. Requiring either/or is the simplest approach and doesn't require the user to understand the rules of merging the arguments attribute and the <spring:arguments> elements.

philwebb added a commit that referenced this pull request Jul 22, 2013
# By Nicholas Williams
* SPR-9678:
  Add <spring:argument> subtag for message/theme
  Ensure ParamTag release resources
  Fix malformed UrlTag Javadoc
  Update TLD versions to 4.0
@philwebb
Copy link
Member

I see your point but I have run with the merge arguments options for now. I don't think it's too confusing since the arguments attribute always appears before the nested tags so the order seems fairly logical to me. I also wanted to get this in before M2, we can refine before RC1 if you feel strongly that this is the wrong call.

@philwebb philwebb closed this Jul 22, 2013
@beamerblvd beamerblvd deleted the SPR-9678 branch July 22, 2013 18:05
@beamerblvd
Copy link
Contributor Author

I do believe that could cause more problems than it will solve, but we'll see. Thanks for merging! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants