-
Aug 10th, 2012, 05:38 AM
#1
Empty Input Value (type=text) Is Passed To Controller
I'm working on a web application and I have a jsp portlet and a controller. The form in the portlet has two fields, one of type text while the other is a combo box. I only get an empty value in the controller for the input with attribute value and type text while the value from the combox box is received correctly in the controller.
I have added a snippet of the controller and the jsp form below. Please advise.
---- JSP Portlet -----
<form id="mapParametersForm" method="post" action="report.form">
<input type="hidden" name="mapped" value="mappedForm"/>
<table>
<tr>
<td>Key:</td>
<td><input type="text" name="newkey" id="newDsdKey" size="20" value="Type here"/></td>
</tr>
<tr>
<td>DataSetDefinition:</td>
<td>
<select name="definitionName">
<c:forEach items="${dataSetDefinitionNames}" var="dataSetDefinitionName" >
<option value="${dataSetDefinitionName}">${dataSetDefiniti onName}</option>
</c:forEach>
</select>
</td>
</tr>
</table>
<hr style="color:blue;"/>
<div style="width:100%; text-align:left;">
<input type="button" name="send" id="mapParametersFormSubmitButton" class="ui-button ui-state-default ui-corner-all" value="Submit"/>
<input type="button" id="mapParametersFormCancelButton" class="ui-button ui-state-default ui-corner-all" value="Cancel"/>
</div>
</form>
----- CONTROLLER -----
else if ("mappedForm".equals(mapped)) {
String newKey = request.getParameter("newKey");
String definitionName = ServletRequestUtils.getStringParameter(request, "definitionName", "");
System.out.println("newKey " + newKey);
System.out.println("definitionName " + definitionName);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules