Struts 2
  1. Struts 2
  2. WW-3289

Error when rendering <s:select> tag that contains UTF-8 characters in "listValue" attribute AFTER client-side validation

    Details

    • Type: Temp Temp
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Not a Problem
    • Affects Version/s: 2.1.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Centos 5.3
      Java 1.6
      Tomcat 6.0.20
      Struts 2.1.8

      Description

      Hi:
      I really don't know what component is the one that is failing (I guess the validation interceptor), so I'll try to explain as many details as possible.

      I have my form.jsp as follows:

      <s:form action="saveTeam" namespace="/2" method="post" enctype="multipart/form-data" validate="true">
      <s:textfield name="team.name" value="%

      {team.name}

      " label="%

      {getText('label.name')}

      " size="25" required="true" maxlength="50"/>
      <s:select name="team.stadium.idStadium" value="%

      {team.stadium.idStadium}

      " label="%

      {getText('label.stadium')}

      " list="stadiums" listKey="idStadium" listValue="name"/>
      <s:file name="image" label="label.image" accept="image/jpeg"/>
      <s:hidden name="team.idTeam" value="%

      {team.idTeam}

      "/>
      <s:submit value="%

      {getText('button.label.submit')}

      "/>
      </s:form>

      I used the "Preparable interface approach" to repopulate controls when validation fails, and it worked flawlessly, but... in this example, when the name of the stadium has UTF-8 characters (for example: á, ñ, ö), the HTML page doesn't finish rendering AFTER validation errors (the first time, the form.jsp is displayed correctly without problems), and it stops at the <select> tag before the "weird" character.

      This is the HTML code:

      <form id="saveTeam" name="saveTeam" onsubmit="return validateForm_saveTeam();" action="/2/saveTeam.action" method="post" enctype="multipart/form-data" onreset="clearErrorMessages(this);clearErrorLabels(this);">
      <table class="wwFormTable">
      <tbody><tr errorfor="saveTeam_team_name">
      <td colspan="2" align="center" valign="top"><span class="errorMessage">You must enter a name!</span></td>
      </tr>
      <tr>
      <td class="tdLabel"><label for="saveTeam_team_name" class="errorLabel">Name<span class="required">*</span>:</label></td>
      <td><input name="team.name" size="25" maxlength="50" value="" id="saveTeam_team_name" type="text"></td>
      </tr>

      <tr>
      <td class="tdLabel"><label for="saveTeam_team_stadium_idStadium" class="label">Stadium:</label></td>
      <td><select name="team.stadium.idStadium" id="saveTeam_team_stadium_idStadium">
      <option value="3" selected="selected">Deportivo Espa

      The stadium name is "Deportivo España", but somehow the "ñ" isn't displayed, and everything after that is ignored.
      I also tried with other characters like á or ö, and every time the <select> tag reaches the firs UTF-8 character it stops displaying the rest of the page.
      This ONLY happens AFTER validation errors. The first time the page is rendered, "Deportivo España" is shown correctly, and if I submit the form without any validation errors it works without problems.
      Also if there aren't any "strange" characters like "ñ", when there are validation errors the select tag displays correctly AFTER validation too.
      I think this is an UTF8 problem...

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Fernando Manrique
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development