现在的位置: 首页 > 综合 > 正文

用标签写登录界面

2014年01月16日 ⁄ 综合 ⁄ 共 909字 ⁄ 字号 评论关闭

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>

4、运行结果如下:


抱歉!评论已关闭.