SpringMVC标签有如下标签:
form | 渲染标签 |
input | 渲染input元素 |
password | 渲染元素 |
hidde | 渲染元素 |
textare | 渲染元素 |
checkbox | 渲染元素 |
checkboxs | 渲染元素 |
radiobutton | 渲染元素 |
radiobuttons | 渲染元素 |
select | 渲染元素 |
注意:
1、要用form标签首先要导入form标签链接,就像用c标签一样;
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
2、form标签它是和javaBean绑定的,所以jsp页面的标签的path必须是在javaBean中存在的,
如果不存在系统就会报错;
org.springframework.beans.NotReadablePropertyException: Invalid property 'i' of bean class [app05a.domain.Book]: Bean property 'i' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:707)
让你误以为是你自己忘记写set/get方法了!
3、一定要通过服务器,也就是要实例化,不然它也会报注意2中一样的错误。
4、SpringMVC的form标签其实在功能上和平时的一些html标签是一样的,只是用法不一样,它还有一个好处就是当输入验证失败时它会重新生成一个html表单,
项目结构图如下: