How can I possibly set a value for a form input field using the form tag library in Spring MVC shown below even if it has no value attribute and is not accepted according to form tld?
<form:input path ="name" id="name" cssStyle="display: none"/>
Not based on requirement:
<input type="hidden" id="name" value="Raven"/>
Don't use a <form:input>
? It's for binding to beans.
You can use a regular <input>
element ;)
If you want to set its value:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<c:set var="name" value="Raven" />
<input type="hidden" name="name" value="<c:out value='${name}' />" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.