Details
-
Temp
-
Status: Closed
-
Trivial
-
Resolution: Not A Problem
-
2.1.8
-
None
-
None
-
None
-
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="%
" label="%
{getText('label.name')}" size="25" required="true" maxlength="50"/>
<s:select name="team.stadium.idStadium" value="%
" 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="%
"/>
<s:submit value="%
"/>
</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...