首页 > 代码库 > 使用Form标签库制作登录表单
使用Form标签库制作登录表单
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>SpringMVC</title><link href="http://www.mamicode.com/style/style.css" rel="stylesheet" type="text/css"/><script type="text/javascript"> function refreshVcode(){ document.getElementById("vcode").src="http://www.mamicode.com/images/vcode.jpg?r="+Math.random(); }</script></head><body> <!-- 对象要和表单绑定,把对象传递过来 --> <form:form action="" method="post" commandName="form"> <tr> <td>登录名:</td> <td> <form:input path="loginName" /> </td> </tr> <tr> <td>密码:</td> <td> <form:password path="password" /> </td> </tr> <tr> <td></td> <td> <input type="submit" value="http://www.mamicode.com/登陆"/> </td> </tr> </form:form></body></html>
ublic class LoginController { //方法的返回值返回一个对象 @ModelAttribute("form") public LoginForm getForm(){ return new LoginForm(); } //我发送请求要访问login.html页面 @RequestMapping(value="http://www.mamicode.com/login",method=RequestMethod.GET) public String showLogin(){ return "login"; }
使用Form标签库制作登录表单
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。