struts2 Getting Started struts2 Profile - the first program

2010-03-25  来源:本站原创  分类:Java  人气:225 

Struts2 Introduction
Struts2 six years after the birth of the development, struts1 are already quite mature, but it is original in design flaws have been limited his development, for example, he can only inherit Action or dispatchAction inheritance is single inheritance. Action in the execute method does not debug struts1 This shows that is far too dependent on the servletAPI. In order to better development struts2 appeared, struts2 interceptors used to process customer requests, making controllers and servletAPI completely separate. Struts2 to use the core design patterns webwork achieved.

The status of the current web framework
struts2: simple and flexible web framework
Spring web framework: The most comprehensive web framework
Struts1: most resource-rich web framework
Tapestry: Components of the most perfect web framework
Jsf: closest to the web framework for asp.net

Struts2 with other web frameworks comparison
Struts1 vs struts2: struts1 inherited defects in a single action on the container's dependence expression language is incomplete, difficult to use, authentication type conversion error.
Struts2 vs jsf: jsf defect aop dependency injection to achieve, over-reliance on the container.
Struts2 vs spring web framework: the lack of the latter's tag library, type conversion issues.

Struts1 a detailed comparison with the struts2
Action Comparison: struts1 in the action could only be single inheritance, when this class inherits the class action after the other classes can not inherit, limiting expansion of inheritance class action. Struts2 in action interface can be seen, or inherit actionsupport class.
Thread compare: struts1 in action is a single case, meaning that when a user visits action only when it creates an action to handle the user's request, so also there will be a thread-safety issues, when multiple users simultaneous access to time , there will be resource consumption issues. Struts2 a good solution to this problem, it will be a visit to create an action, the thread does not appear, but also have a problem is that it will continue with action to create an instance of class kept occupied.
Servlet API: struts1 implements the servlet API exposed to the outside in a way, over-reliance on container servlet API. Struts2 do not rely on the container.
Get the object comparison: struts1 through actionform to get the value. Struts2 directly through the realization of the properties of the class action can access more convenient and direct.
Foreground language comparison: struts1 is jstl el. struts2 by ognl

Struts downloading and struts2 Download the zip file, unzip the folder after
Apps: struts2 examples of documents useful for beginners.
Lib: struts2 framework of the core jar package.
Src: includes struts2 of all the source code.
Docs: related documents, api documentation, Quick Start and so on.
J4: Let struts2 support jdk1.4 for jar package NOTE: struts2 right tomcate server requirements must be 5.5 or later.

Actual case development to prepare:
1. Copy the required jar package into the project, in the struts2 five in the core jar package: common-logging.jar ognl.jar, xwork.jar, struts2-core.jar, freemarker.jar
2. Struts.xml used to describe the action, is the core of the use of struts2.

Actual development to achieve a simple application of a simple project steps in struts2
1, will be ready just paste into the project jar package lib directory.
2, modify the web.xml file, configure the interceptor.
3, create a struts.xml file in src directory, as struts2 is the default in the src directory to read struts2.xml files, all file names and path is fixed.
4, create a class action to achieve Action interface, or inherit actionsupport class
5, modify struts.xml registered in the struts.xml file class action.
6, create a request for a visit.

* The annex is for the first example of a simple entry

相关文章
  • S2SH (Struts2 + Spring + Hibernate) integration profile 2009-07-26

    S2SH (Struts2 + Spring + Hibernate) integration profile 1.web.xml file configuration is as follows: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmln

  • S2SJ (Struts2 + Spring + JPA) integration profile 2009-08-07

    S2SJ (Struts2 + Spring + JPA) integration profile 1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XML

  • One study notes struts2 (PART 1. Struts2 Introduction and Configuration) 2011-01-05

    One study notes struts2 (PART 1. Struts2 Introduction and Configuration) First, the development environment IDE: MyEclipse6.0 version Servlet Container: Tomcat6.0 Second, create a web project Project Name: struts2 1, function: to complete a user logo

  • 修复struts严重漏洞:升级struts2.2到 struts2.3.1 2013-07-19

    简单测试你的action地址:http://www.yourdomian.com/test.action?redirect:http://www.baidu.com 是否跳转到百度 修复struts严重漏洞:升级struts2.2到 struts2.3.1 需要升级以下包: struts2-core-2.3.15.1.jar struts2-spring-plugin-2.3.15.1.jar xwork-core-2.3.15.1.jar commons-lang3-3.1.jar ognl-

  • struts2 Getting Started struts2 Profile - the first program 2010-03-25

    Struts2 Introduction Struts2 six years after the birth of the development, struts1 are already quite mature, but it is original in design flaws have been limited his development, for example, he can only inherit Action or dispatchAction inheritance i

  • Struts2 Study Notes 2 --- profile 2010-04-12

    In Struts2 in two main configuration files: web.xml and struts.xml, when a new web project, you can sample from the Struts2 copy of the program, and then make the appropriate modifications. The basic form of web.xml as follows: <web-app version="2

  • struts2 of struts.properties profile Xiangjie 2010-04-16

    struts.action.extension The URL extension to use to determine if the request is meant for a Struts action Extension with the URL to determine if the request is to be used as a Struts action, that is, in fact set the action of the suffix, such as logi

  • Struts2 Notes - 06 Struts2 treatment processes and management style Action 2010-03-29

    Struts2 treatment processes and management style Action User requests ↓ StrutsPrepareAndExecuteFilter (web.xml to configure the filter, is the Struts2 core controller, responsible for the interception by the <url-pattern> / * </ url-patter> sp

  • Struts2 Study Notes 3 ----- Struts2 configuration and Struts2 in a constant search of the order of constant 2010-03-29

    In Struts you can configure the constants in the following documents: default.properties files (there are a lot of constants) struts-default.xml struts-plugin.xml struts.xml struts.properties (in order to provide backward compatibility with the webwo

  • Developing Detail Explain Struts2 application - 7.Struts2 common request constant definition and description suffix 2010-09-21

    Struts2 requested suffix defaults to. Action. If you do not take. Action parameter access is enabled by default suffix is present. Action. To access the suffix can be modified Struts2 struts.xml modify the configuration parameters are as follows: <co

  • Developing Detail Explain Struts2 application - 8.Struts2 Process 2010-09-22

    1, analysis filters in web.xml org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter, on a request to question the path for resolution, line extension standards for the implementation of Step 2. 2, one by one the implementation of the

  • struts2.1.6 struts2.1.6 version with previous versions of configuration differences 2011-07-13

    struts2.1 Struts2.0 upgrade , So their configuration is a little different places . struts2.1.6 Versions prior to configuration : <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-

  • Struts2学习(二):struts2配置详解! 2013-07-19

    Struts2框架按照以下搜索顺序加载Struts2常量: 1.struts-default.xml---该文件保存在struts2-core-2.x.x.jar文件中 2.struts-pluugin.xml---在struts2一些插件jar包里,比如struts2-xxx-plugin-2.3.x.x.jar 3.struts.xml---Web应用默认的Struts2配置文件 4.struts.properties---Web应用默认的Struts2配置文件 5.web.xml--Web

  • Struts2学习笔记--Struts2登陆验证项目 2015-03-27

    为项目添加Struts2支持,用的是struts-2.1.6版本的Struts2 Struts2的struts-2.1.6的下载链接,在我的百度网盘里面有 http://pan.baidu.com/s/1bn8PANl 在下载好的Struts2目录的lib下找到下面的jar包,复制到项目的WEB-INF下的lib中 配置struts.xml文件,在项目src目录下新建struts.xml文件,配置如下代码 <?xml version="1.0" encoding="UT

  • struts2示例代码-struts2的配置 2015-04-21

    这篇文章是关于struts2的配置,之前我在网上或者贴吧上都看到很多人在问struts2的配置问题.所以写这篇来给需要帮助的人,struts2的配置并不复杂. 一.先准备好需要的6个jar包(反正我配置的时候就需要到6个): 1.commons-fileupload-1.2.1.jar 2.commons-io-1.3.2.jar 3.freemarker-2.3.15.jar 4.ognl-2.7.3.jar 5.struts2-core-2.1.8.jar 6.xwork-core-2.1.

  • Struts2 study notes (a) set up the environment and the HelloWorld program 2010-10-14

    Struts2 first experience 1, you need to configure Struts2 Web.xml file filters FilterDispatcher. Web.xml configured in the complete code is as follows: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xm

  • Struts2 + hibernate + spring integration to download the configuration program 2011-04-24

    Struts2 + hibernate + spring integration to download the configuration program SSH configuration is complicated because the project needs to import a lot of jar package, but also on the relevant xml configuration. Configuration is a headache for the

  • Struts2 international support for boot (early) 2010-03-29

    This article is KenCheng the process of making records DEMO welcome reproduced, reproduced please specify source. Text covering part of the provisional can not upload a screenshot up, accessories for the WORD version of this article (less full), such

  • struts2 + hibernate3.2 + spring2.0 instance configuration + Getting Started 2010-04-13

    eclipse3.2, myeclipse5.0, Jboss4.0.3, sql server2000 sp3 Principle of In the java enterprise applications, ejb powerful ejb configuration with the complex and difficult to learn as well known. But in the past and what we do? Just bite the bullet and

  • Dwell on the core concepts Struts2 2010-04-20

    This article is reproduced Office: http://www.javasuper.com/a/jishuwendang/2010/0324/54.html This article will examine the core Struts2 concept, first introduced the Struts2 architecture and several important configuration files, and will illustrate