id and name attributes should have the same value for the form tag
------------------------------------------------------------------

                 Key: WW-2951
                 URL: https://issues.apache.org/struts/browse/WW-2951
             Project: Struts 2
          Issue Type: Improvement
          Components: Plugin - Tags
    Affects Versions: 2.0.14
            Reporter: Jean-Michel Morel
            Priority: Minor


if they are not provided by the s:form tag, the form component use the action 
name to fill 'id' and 'name' attributes.
In the case where only the id is given, id and name attributes have different 
values which is not recommended, especially in xhtml form: if the both are 
present, they should have the same value.

the Form Component is responsible for this behaviour, I've seen in 
evaluateExtraParamsServletRequest(...) method the following lines :

           // if the name isn't specified, use the action name
            if (name == null) {
                addParameter("name", action);
            }

            // if the id isn't specified, use the action name
            if (id == null && action!=null) {
                addParameter("id", escape(action));
            }

which should be :

            // if the name isn't specified, use the id name or the action name
            if (name == null) {
                if (id != null) {
                    addParameter("name", id);
                 }
                else if (action!=null) {
                    addParameter("name", action);
                 }
            }

            // if the id isn't specified, use the action name
            if (id == null && action!=null) {
                addParameter("id", escape(action));
            }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to