I am trying to create a form in Spring MVC.
I would like to set action attribute of the <form> element dynamically using scriplet or something else.
MyForm:
<form:form id="myForm" modelAttribute="myFormBean"
action="<%=baseUrl%>/myFormControllerPattern" name="myForm">
<fieldset>
<table>
<tr>
<th>Name</th>
<td><form:input path="name" /></td>
</tr>
<tr>
<th>Age</th>
<td><form:input path="age"/></td>
</tr>
</table>
</fieldset>
</form:form>
Error:
attribute for %>” is not properly terminated
Found the solution. Thanks to jelies.
Added baseUrl in my controller like this:
and then used it in my form in JSP: