You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2010/03/31 21:39:27 UTC
[jira] Commented: (WW-3425) Refactoring of Reset tag when testing
if the key/value were entered
[ https://issues.apache.org/jira/browse/WW-3425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852069#action_12852069 ]
Lukasz Lenart commented on WW-3425:
-----------------------------------
Nice, but I will have to merge as I'm working on WW-2624 ;-)
> Refactoring of Reset tag when testing if the key/value were entered
> -------------------------------------------------------------------
>
> Key: WW-3425
> URL: https://issues.apache.org/jira/browse/WW-3425
> Project: Struts 2
> Issue Type: Improvement
> Components: Other
> Affects Versions: 2.2.0
> Reporter: Cristian Peraferrer
> Priority: Trivial
> Attachments: resetTagRefactored.patch
>
>
> Tiny code refactoring in the reset tag code when testing if the key/value are present. There is no need to test if value is null two times.
> I have also corrected some typos in the comments/javadoc.
> Here the patch:
> Index: core/src/main/java/org/apache/struts2/components/Reset.java
> ===================================================================
> --- core/src/main/java/org/apache/struts2/components/Reset.java (revision 929448)
> +++ core/src/main/java/org/apache/struts2/components/Reset.java (working copy)
> @@ -37,7 +37,7 @@
> * <li>input: renders as html <input type="reset"...></li>
> * <li>button: renders as html <button type="reset"...></li>
> * </ul>
> - * Please note that the button type has advantages by adding the possibility to seperate the submitted value from the
> + * Please note that the button type has advantages by adding the possibility to separate the submitted value from the
> * text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
> * <!-- END SNIPPET: javadoc -->
> *
> @@ -51,7 +51,7 @@
> *
> * <pre>
> * <!-- START SNIPPET: example2 -->
> - * Render an button reset:
> + * Render a reset button:
> * <s:reset type="button" key="reset"/>
> * <!-- END SNIPPET: example2 -->
> * </pre>
> @@ -83,14 +83,10 @@
>
> public void evaluateParams() {
>
> - if ((key == null) && (value == null)) {
> - value = "Reset";
> + if (value == null) {
> + value = (key != null ? "%{getText('"+key+"')}" : "Reset");
> }
>
> - if (((key != null)) && (value == null)) {
> - this.value = "%{getText('"+key +"')}";
> - }
> -
> super.evaluateParams();
>
> }
> @@ -98,7 +94,7 @@
> /**
> * Indicate whether the concrete button supports the type "image".
> *
> - * @return <tt>false</tt> to indicate type image is supported.
> + * @return <tt>false</tt> to indicate type image is not supported.
> */
> protected boolean supportsImageType() {
> return false;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.