1、新建一个jsp页面,为login.jsp;
2、导入标签,<%@ taglib prefix="s" uri="/struts-tags" %>
3、然后利用jsp标签写表单,源码如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>用标签写登录界面</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> </head> <body> <s:form action="login1"> <s:textfield name="username" label="username"></s:textfield> <s:password name="password" label="password"></s:password> <s:submit name="submit" label="submit"></s:submit> <s:reset name="reset" label="reset"></s:reset> </s:form>
<!--
username:<%=request.getParameter("username") %><br> password:<%=request.getParameter("password") %>
--> </body> </html>
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。