Just remove the "path" from the jsp input tag and use HttpServletRequest to retrieve the remaining data.
For example I have a bean like
public class SomeData {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Then in the jsp i will have the additional data fields to be send in normal html tag
<form:form method="post" action="somepage" commandName="somedata">
<table>
<tr>
<td>name</td>
<td><form:input path="name" /></td>
</tr>
<tr>
<td>age</td>
<!--Notice, this is normal html tag, will not be bound to an object -->
<td><input name="age" type="text"/></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="send"/>
</td>
</tr>
</table>
</form:form>
Notice, the somedata bean has the name field the age is not. So the age field is added without "path". Without the path attribute the object property wont be bound to this field.
on the Controller i will have to use the HttpServletRequest like,
@RequestMapping("/somepage")
public String someAction(@ModelAttribute("somedata") SomeData data, Map<String, Object> map,
HttpServletRequest request) {
System.out.println("Name=" + data.getName() + " age=" + request.getParameter("age"));
/* do some process and send back the data */
map.put("somedata", data);
map.put("age", request.getParameter("age"));
return "somepage";
}
while accessing the data on the view,
<table>
<tr>
<td>name</td>
<td>${somedata.name}</td>
</tr>
<tr>
<td>age</td>
<td>${age}</td>
</tr>
</table>
somedata is the bean which provides the name property and age is explicitly set attribute by the controller.