You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by gregh3269 <gi...@git.apache.org> on 2016/02/10 09:56:29 UTC

[GitHub] struts pull request: Allow html5 attributes

GitHub user gregh3269 opened a pull request:

    https://github.com/apache/struts/pull/86

    Allow html5 attributes

    See WW-4607

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gregh3269/struts master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/struts/pull/86.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #86
    
----
commit 40f7b39c3f1f99de1806a5afb84166090f00d4ce
Author: gregh3269 <gr...@gmail.com>
Date:   2016-02-10T08:53:32Z

    Allow html5 attributes

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by gregh3269 <gi...@git.apache.org>.
Github user gregh3269 commented on a diff in the pull request:

    https://github.com/apache/struts/pull/86#discussion_r52437467
  
    --- Diff: plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/TextFieldHandler.java ---
    @@ -31,8 +31,8 @@
         public void generate() throws IOException {
             Map<String, Object> params = context.getParameters();
             Attributes attr = new Attributes();
    -
    -        attr.add("type", "text")
    +        Object type = params.get("type");
    +        attr.add("type", type == null ? "text" : (String) type)
    --- End diff --
    
    Object type = params.get("type");
    attr.add("type", type == null ? "text" : type.toString())
    
    valueOf checks for nulls and calls .toString can skip the check?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by lukaszlenart <gi...@git.apache.org>.
Github user lukaszlenart commented on a diff in the pull request:

    https://github.com/apache/struts/pull/86#discussion_r52450951
  
    --- Diff: plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/TextFieldHandler.java ---
    @@ -31,8 +31,8 @@
         public void generate() throws IOException {
             Map<String, Object> params = context.getParameters();
             Attributes attr = new Attributes();
    -
    -        attr.add("type", "text")
    +        Object type = params.get("type");
    +        attr.add("type", type == null ? "text" : (String) type)
    --- End diff --
    
    You must check for `null` because `String.valueOf(null)` will return a String "null" :\ I think the current solution is ok :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/struts/pull/86


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by gregh3269 <gi...@git.apache.org>.
Github user gregh3269 commented on a diff in the pull request:

    https://github.com/apache/struts/pull/86#discussion_r52433247
  
    --- Diff: plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/TextFieldHandler.java ---
    @@ -31,8 +31,8 @@
         public void generate() throws IOException {
             Map<String, Object> params = context.getParameters();
             Attributes attr = new Attributes();
    -
    -        attr.add("type", "text")
    +        Object type = params.get("type");
    +        attr.add("type", type == null ? "text" : (String) type)
    --- End diff --
    
    I did use originally .valueOf and then checking the other handlers they all used the cast, so matched what they use, for code style.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by lukaszlenart <gi...@git.apache.org>.
Github user lukaszlenart commented on a diff in the pull request:

    https://github.com/apache/struts/pull/86#discussion_r52431155
  
    --- Diff: plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/TextFieldHandler.java ---
    @@ -31,8 +31,8 @@
         public void generate() throws IOException {
             Map<String, Object> params = context.getParameters();
             Attributes attr = new Attributes();
    -
    -        attr.add("type", "text")
    +        Object type = params.get("type");
    +        attr.add("type", type == null ? "text" : (String) type)
    --- End diff --
    
    Maybe it would be better to use a safe way, ie. `String.valueOf(type)`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[GitHub] struts pull request: Allow html5 attributes

Posted by lukaszlenart <gi...@git.apache.org>.
Github user lukaszlenart commented on a diff in the pull request:

    https://github.com/apache/struts/pull/86#discussion_r52433490
  
    --- Diff: plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/TextFieldHandler.java ---
    @@ -31,8 +31,8 @@
         public void generate() throws IOException {
             Map<String, Object> params = context.getParameters();
             Attributes attr = new Attributes();
    -
    -        attr.add("type", "text")
    +        Object type = params.get("type");
    +        attr.add("type", type == null ? "text" : (String) type)
    --- End diff --
    
    Maybe you could refactor the rest as well and use `String.valueOf` or leave it as is, up to you :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org