struts2 标签登陆例子(简单)
来源:互联网 发布:python 数据分析 pdf 编辑:程序博客网 时间:2024/04/28 12:54
文件目录:
文件内容:
ZLoginAction.java
package com.zxl.action;import com.opensymphony.xwork2.ActionSupport;public class ZLoginAction extends ActionSupport {public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}private String username;private String password;public String execute() throws Exception {if(username.equals("a")&&password.equals("b")){return SUCCESS;}else {return INPUT;} }}struts.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><!-- 改变url现实的后缀,默认是action --> <constant name="struts.action.extension" value="xhtml" /> <package name="struts2login" extends="struts-default"> <!-- 这里的Class是由Spring里面制定的ID,如果单独用struts2,则这里是包名+类名 --><action name="LoginAction" class="com.zxl.action.ZLoginAction"><result name="success" >/welcome.jsp</result><result name="input">/Login.jsp</result></action></package></struts>web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Struts3</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping> </web-app>Login.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib uri="/struts-tags" prefix="s" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body><s:form action="LoginAction" method="post"> <s:label value="login"></s:label> <s:textfield name="username" label="username"></s:textfield> <s:password name="password" label="password"></s:password> <s:submit value="ok" ></s:submit> </s:form></body></html>welcome.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body>welcome</body></html>
- struts2 标签登陆例子(简单)
- Struts2学习(二)---一个struts2的登陆例子
- 简单的Struts2登陆
- 简单的Struts2登陆
- Struts2简单登陆实例
- Struts2.0登陆小例子
- Struts2 + Spring 整合简单例子(转)
- Struts2简单例子
- Struts2的简单例子
- struts2简单例子
- spring入门简单登陆例子
- Struts2自定义简单标签
- 自定义Struts2简单标签
- struts2标签简单说说
- Struts2 简单的登陆功能
- struts2简单入门-登陆示例
- 20170918_chr_newlogin Struts2实现登陆功能(简单validate验证)
- 一个简单的标签例子
- EBS 资产方面的查询SQL
- ubuntu系统快捷键设置
- Django 自验证
- ubuntu12.04:Tomcat 7服务器:手动安装
- django如何使ForeignKey字段显示树状结构
- struts2 标签登陆例子(简单)
- C语言:全局变量在多个c文件中公用的方法
- ScrollView滚动到指定位置
- Linux下vi使用
- 备用 python Pexpect
- php遍历目录输出目录及其下的所有文件
- qwt的x86平台和arm平台的移植。
- myeclipse2013 去掉 derby
- 循环结构