Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5183

HTML tag's ID attribute's value output by struts is different between struts2.5.26 and struts2.5.30.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Bug
    • 2.5.30
    • None
    • None
    • None

    Description

      Hi!
      I love struts.
      And I updated from 2.5.26 to 2.5.30 to use the latest version.

      And I noticed that the content generated by HTML is different.
      Specifically, the code and output are as follows.

      Hello.jsp

      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib prefix="s" uri="/struts-tags"%>
      <!DOCTYPE html>
      <html>
      <head>
      	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      	<title>Struts2</title>
      </head>
      <body>
      <s:form action="hello-action">
      	<s:textfield name="name" />
      	<s:submit value="submit" />
      </s:form>
      </body>
      </html> 

      struts2.5.26 output

      <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Struts2</title>
      </head>
      <body>
        <form id="hello-action" name="hello-action" action="hello-action" method="post">
          <input type="text" name="name" value="" id="hello-action_name"> <!— The value of the automatically generated ID here is different. —>
          <input type="submit" value="submit" id="hello-action_0">
        </form>
      </body>
      </html> 

      struts2.5.30 output

      <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Struts2</title>
      </head>
      <body>
        <form id="hello_action" name="hello_action" action="hello-action" method="post">
          <input type="text" name="name" value="" id="hello_action_name"> <!— The value of the automatically generated ID here is different. —>
          <input type="submit" value="submit" id="hello_action_0">
        </form>
      </body>
      </html> 

      Previously, the ID value was generated by inheriting the action name.
      However, in 2.5.30, the hyphen is changed to an underscore and output.
      My project uses the jQuery selector. Therefore, accepting this 'struts' change would require changes to all selectors, which is very costly.

      Is this the correct change? Or is it a bug?

      Thank you!

      Attachments

        Activity

          People

            yasserzamani Yasser Zamani
            takehiro.hidaka takehiro.hidaka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: