struts2根据struts2完全学习手册 自己总结_struts2完全教程总结

2020-02-28 其他工作总结 下载本文

struts2根据struts2完全学习手册 自己总结由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“struts2完全教程总结”。

一、struts2简介struts2的配置文件:

(1)struts.xml 配置示例:

“-//Apache Software Foundation//DTD Struts Configuration 2.0//EN”

“http://struts.apache.org/dtds/struts-2.0.dtd”>

HelloWorld

/example

(2)struts.properties配置文件 # # $Id: struts.properties 722328 2008-12-02 01:56:24Z davenewton $ # # Licensed to the Apache Software Foundation(ASF)under one # or more contributor license agreements.See the NOTICE file # distributed with this work for additional information # regarding copyright ownership.The ASF licenses this file # to you under the Apache License, Version 2.0(the # “License”);you may not use this file except in compliance # with the License.You may obtain a copy of the License at # # http://www.daodoc.com/

struts2控制器

(1)核心控制器: FilterDispatcher(在web应用中负责拦截所有的用户请求)

如果用户的请求以.ation结尾,则该请求被转入struts2框架处理。

(2)业务控制器: Action(在struts2中起作用的实际上不是用户自定义的Action,而是系统自动生成的action代理,但该代理是以用户自定义的action为目标的)Action 举例:

package com.user.action;

public cla Login {

} 由以上代码可知:struts2中的action完全是普通的java类。Struts2中action接口不是必须实现的,任何包含有execute()方法的pojo(plain ordinary java object)private String userName;private String paword;public String getUserName(){ } public void setUserName(String userName){ } public String getPaword(){ } public void setPaword(String paword){ }

public String excute(){

} if(“admin”.equals(userName)&&(“paword”.equals(paword))){

} return “succe”;return “error”;}else{ this.paword = paword;return paword;this.userName = userName;return userName;对象都可以作为struts2的action对象。struts2标签库

<%@ page language=“java” import=“java.util.*” pageEncoding=“gbk”%> <%@ taglib prefix=“s” uri=“/struts-tags”%>(引入struts标签)

struts2标签

通讯录

《struts2根据struts2完全学习手册 自己总结.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
struts2根据struts2完全学习手册 自己总结
点击下载文档
相关专题 struts2完全教程总结 手册 struts2完全教程总结 手册
[其他工作总结]相关推荐
    [其他工作总结]热门文章
      下载全文