- 浏览: 2552006 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
tiles2的布局管理(一)spring+struts2+tiles2
official web site
http://tiles.apache.org/
the document is here
http://tiles.apache.org/framework/index.html
The Composite View Pattern
Using the composite view pattern, the other part of the page have been reused, and the layout consistence has been preserved.
Tiles is a composite view framework, it allows to reuse page pieces across the application. But another approach to achive the same result is using the Decorator pattern. For example, Sitemesh is based on the Decorator pattern.
Configuring Tiles
I use spring to integrate struts2 to work as command actions. The configuration file web.xml:
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:main-context.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listerner-class>org.apache.struts2.tiles.StrutsTilesListener</listerner-class>
</listener>
the tiles configuration file tiles.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="base.definition" template="/layout/layout.jsp">
<put-attribute name="title" value="当前客户起始页面"/>
<put-attribute name="banner" value="/content/top.jsp"/>
<put-attribute name="menu" value="/content/menu.jsp"/>
<put-attribute name="sidebar" value="/content/sidebar.jsp"/>
<put-attribute name="hintbar" value="/content/error.jsp"/>
<put-attribute name="body" value="/screen/body.jsp"/>
</definition>
<definition name="index.definition" extends="base.definition">
<put-attribute name="body" value="/screen/index.jsp"/>
</definition>
</tiles-definitions>
we defined one template here named base.definition and every time we can use <put-attribute> to replace one part to form a new page.
the struts2 configuration file 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>
<package name="testp" namespace="/testn" extends="tiles-default">
<action name="hello" method="hello" class="helloAction">
<result name="hello" type="tiles">base.definition</result>
</action>
<action name="ads" method="ads" class="helloAction">
<result name="hello" type="tiles">index.definition</result>
</action>
</package>
</struts>
If we call the method in action, we will render to different tiles template page.
the struts.properties file here is just the same as in spring+struts2:
struts.i18n.encoding=utf-8
#spring configuration
struts.objectFactory=spring
#dev mode flag
struts.devMode=true
struts.action.extension=do
ok, every thing goes well and We can try the urls index.jsp:
you can see this page<br />
<a href="testn/testp/hello.do">hello</a><br />
<a href="testn/testp/ads.do">ads</a><br />
Problem One:
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
File: org/apache/struts2/views/tiles/TilesResult.java
Line number: 105
Stacktraces
java.lang.NullPointerException
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
Solution:
check out the java source file TilesResult.java and view the codes:
TilesContainer container = TilesAccess.getContainer(servletContext);
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
container.render(location, request, response);
the problem is here, the contrainer is null from the serveletContext, and when the web start, we just put the container in listener.but I don't know why, but the org.apache.struts2.tiles.StrutsTilesListener never be called in web.xml, so that may be the problem that we can not have two listeners in one web.xml. So I just recode all the method and function in startupListener.java extends ContextLoaderListener, I just used to do this in spring2.5.6 and spring mvc controller,and it works well.
but here, since we use spring 3.0 + struts2, it still cause problem.
Problem Two:
严重: ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2010-7-13 17:09:32 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
it seems that the xwork2.spring.SpringObjectFactory just knows to find org.springframework.web.context.ContextLoaderListener,even my StartupListener is extending the ContextLoaderListener, it is really silly. So I just have to code a new java file org.springframework.web.context.ContextLoaderListener with the same name and same package.But I add the tiles codes there:
package org.springframework.web.context;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.tiles.ConfiguredServletContext;
import org.apache.struts2.tiles.StrutsTilesContainerFactory;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.factory.TilesContainerFactory;
@SuppressWarnings("unchecked")
public class ContextLoaderListener extends ContextLoader implements
ServletContextListener {
protected static final Log LOG = LogFactory
.getLog(ContextLoaderListener.class);
private ContextLoader contextLoader;
private static final Map INIT;
static {
INIT = new HashMap();
INIT.put(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
StrutsTilesContainerFactory.class.getName());
}
public void contextInitialized(ServletContextEvent event) {
this.contextLoader = createContextLoader();
if (this.contextLoader == null) {
this.contextLoader = this;
}
this.contextLoader.initWebApplicationContext(event.getServletContext());
ServletContext servletContext = event.getServletContext();
try {
TilesContainer container = createContainer(servletContext);
TilesAccess.setContainer(servletContext, container);
} catch (TilesException e) {
throw new IllegalStateException("Unable to instantiate container.");
}
}
@Deprecated
protected ContextLoader createContextLoader() {
return null;
}
@Deprecated
public ContextLoader getContextLoader() {
return this.contextLoader;
}
public void contextDestroyed(ServletContextEvent event) {
ServletContext servletContext = event.getServletContext();
try {
TilesAccess.setContainer(servletContext, null);
} catch (TilesException e) {
LOG.warn("Unable to remove tiles container from service.");
}
if (this.contextLoader != null) {
this.contextLoader.closeWebApplicationContext(event
.getServletContext());
}
ContextCleanupListener.cleanupAttributes(event.getServletContext());
}
protected TilesContainer createContainer(ServletContext context)
throws TilesException {
if (context
.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM) == null) {
context = decorate(context);
} else {
LOG
.warn("Tiles container factory is explicitly set. Not injecting struts configuration.");
}
TilesContainerFactory factory = TilesContainerFactory
.getFactory(context);
return factory.createContainer(context);
}
protected ServletContext decorate(ServletContext context) {
return new ConfiguredServletContext(context, INIT);
}
}
then it works fine.
official web site
http://tiles.apache.org/
the document is here
http://tiles.apache.org/framework/index.html
The Composite View Pattern
Using the composite view pattern, the other part of the page have been reused, and the layout consistence has been preserved.
Tiles is a composite view framework, it allows to reuse page pieces across the application. But another approach to achive the same result is using the Decorator pattern. For example, Sitemesh is based on the Decorator pattern.
Configuring Tiles
I use spring to integrate struts2 to work as command actions. The configuration file web.xml:
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:main-context.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listerner-class>org.apache.struts2.tiles.StrutsTilesListener</listerner-class>
</listener>
the tiles configuration file tiles.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="base.definition" template="/layout/layout.jsp">
<put-attribute name="title" value="当前客户起始页面"/>
<put-attribute name="banner" value="/content/top.jsp"/>
<put-attribute name="menu" value="/content/menu.jsp"/>
<put-attribute name="sidebar" value="/content/sidebar.jsp"/>
<put-attribute name="hintbar" value="/content/error.jsp"/>
<put-attribute name="body" value="/screen/body.jsp"/>
</definition>
<definition name="index.definition" extends="base.definition">
<put-attribute name="body" value="/screen/index.jsp"/>
</definition>
</tiles-definitions>
we defined one template here named base.definition and every time we can use <put-attribute> to replace one part to form a new page.
the struts2 configuration file 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>
<package name="testp" namespace="/testn" extends="tiles-default">
<action name="hello" method="hello" class="helloAction">
<result name="hello" type="tiles">base.definition</result>
</action>
<action name="ads" method="ads" class="helloAction">
<result name="hello" type="tiles">index.definition</result>
</action>
</package>
</struts>
If we call the method in action, we will render to different tiles template page.
the struts.properties file here is just the same as in spring+struts2:
struts.i18n.encoding=utf-8
#spring configuration
struts.objectFactory=spring
#dev mode flag
struts.devMode=true
struts.action.extension=do
ok, every thing goes well and We can try the urls index.jsp:
you can see this page<br />
<a href="testn/testp/hello.do">hello</a><br />
<a href="testn/testp/ads.do">ads</a><br />
Problem One:
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
File: org/apache/struts2/views/tiles/TilesResult.java
Line number: 105
Stacktraces
java.lang.NullPointerException
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
Solution:
check out the java source file TilesResult.java and view the codes:
TilesContainer container = TilesAccess.getContainer(servletContext);
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
container.render(location, request, response);
the problem is here, the contrainer is null from the serveletContext, and when the web start, we just put the container in listener.but I don't know why, but the org.apache.struts2.tiles.StrutsTilesListener never be called in web.xml, so that may be the problem that we can not have two listeners in one web.xml. So I just recode all the method and function in startupListener.java extends ContextLoaderListener, I just used to do this in spring2.5.6 and spring mvc controller,and it works well.
but here, since we use spring 3.0 + struts2, it still cause problem.
Problem Two:
严重: ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2010-7-13 17:09:32 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
it seems that the xwork2.spring.SpringObjectFactory just knows to find org.springframework.web.context.ContextLoaderListener,even my StartupListener is extending the ContextLoaderListener, it is really silly. So I just have to code a new java file org.springframework.web.context.ContextLoaderListener with the same name and same package.But I add the tiles codes there:
package org.springframework.web.context;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.tiles.ConfiguredServletContext;
import org.apache.struts2.tiles.StrutsTilesContainerFactory;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.factory.TilesContainerFactory;
@SuppressWarnings("unchecked")
public class ContextLoaderListener extends ContextLoader implements
ServletContextListener {
protected static final Log LOG = LogFactory
.getLog(ContextLoaderListener.class);
private ContextLoader contextLoader;
private static final Map INIT;
static {
INIT = new HashMap();
INIT.put(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
StrutsTilesContainerFactory.class.getName());
}
public void contextInitialized(ServletContextEvent event) {
this.contextLoader = createContextLoader();
if (this.contextLoader == null) {
this.contextLoader = this;
}
this.contextLoader.initWebApplicationContext(event.getServletContext());
ServletContext servletContext = event.getServletContext();
try {
TilesContainer container = createContainer(servletContext);
TilesAccess.setContainer(servletContext, container);
} catch (TilesException e) {
throw new IllegalStateException("Unable to instantiate container.");
}
}
@Deprecated
protected ContextLoader createContextLoader() {
return null;
}
@Deprecated
public ContextLoader getContextLoader() {
return this.contextLoader;
}
public void contextDestroyed(ServletContextEvent event) {
ServletContext servletContext = event.getServletContext();
try {
TilesAccess.setContainer(servletContext, null);
} catch (TilesException e) {
LOG.warn("Unable to remove tiles container from service.");
}
if (this.contextLoader != null) {
this.contextLoader.closeWebApplicationContext(event
.getServletContext());
}
ContextCleanupListener.cleanupAttributes(event.getServletContext());
}
protected TilesContainer createContainer(ServletContext context)
throws TilesException {
if (context
.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM) == null) {
context = decorate(context);
} else {
LOG
.warn("Tiles container factory is explicitly set. Not injecting struts configuration.");
}
TilesContainerFactory factory = TilesContainerFactory
.getFactory(context);
return factory.createContainer(context);
}
protected ServletContext decorate(ServletContext context) {
return new ConfiguredServletContext(context, INIT);
}
}
then it works fine.
发表评论
-
Update Site will come soon
2021-06-02 04:10 1678I am still keep notes my tech n ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 431Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 374Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 455VPN Server 2020(2)Docker on Cen ... -
Nginx Deal with OPTIONS in HTTP Protocol
2020-02-15 01:33 356Nginx Deal with OPTIONS in HTTP ... -
PDF to HTML 2020(1)pdftohtml Linux tool or PDFBox
2020-01-29 07:37 405PDF to HTML 2020(1)pdftohtml Li ... -
Elasticsearch Cluster 2019(2)Kibana Issue or Upgrade
2020-01-12 03:25 720Elasticsearch Cluster 2019(2)Ki ... -
Spark Streaming 2020(1)Investigation
2020-01-08 07:19 295Spark Streaming 2020(1)Investig ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 294Hadoop Docker 2019 Version 3.2. ... -
MongoDB 2019(3)Security and Auth
2019-11-16 06:48 241MongoDB 2019(3)Security and Aut ... -
MongoDB 2019(1)Install 4.2.1 Single and Cluster
2019-11-11 05:07 294MongoDB 2019(1) Follow this ht ... -
Monitor Tool 2019(1)Monit Installation and Usage
2019-10-17 08:22 325Monitor Tool 2019(1)Monit Insta ... -
Ansible 2019(1)Introduction and Installation on Ubuntu and CentOS
2019-10-12 06:15 312Ansible 2019(1)Introduction and ... -
Timezone and Time on All Servers and Docker Containers
2019-10-10 11:18 332Timezone and Time on All Server ... -
Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7
2019-10-05 23:28 283Kafka Cluster 2019(6) 3 Nodes C ... -
K8S Helm(1)Understand YAML and Kubectl Pod and Deployment
2019-10-01 01:21 326K8S Helm(1)Understand YAML and ... -
Rancher and k8s 2019(5)Private Registry
2019-09-27 03:25 362Rancher and k8s 2019(5)Private ... -
Jenkins 2019 Cluster(1)Version 2.194
2019-09-12 02:53 444Jenkins 2019 Cluster(1)Version ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 373Redis Cluster 2019(3)Redis Clus ...
相关推荐
同时,Spring的事务管理可以跨多个服务(包括Struts的Action和Hibernate的DAO)进行统一管理,确保了事务的一致性。 在实际项目中,SSH框架通常结合其他技术,如JSF、AJAX、Tiles等,以增强用户体验和页面动态性。...
标题中的"spring+struts1+hibernate+jbpm实例"揭示了这是一个基于Java技术栈的Web应用程序开发实例,其中涉及四大核心技术:Spring、Struts1、Hibernate和JBPM。接下来,我们将深入探讨这些技术及其在实际项目中的...
Spring、Struts和Hibernate是Java开发中非常经典的三大框架,它们各自负责应用程序的不同层面:Spring作为全面的容器和依赖注入框架,负责管理对象和提供事务处理;Struts则是一个MVC(模型-视图-控制器)框架,主要...
(2)运用struts1.2+hibernate+spring 框架,数据库连接池,事务管理; (3)Struts 应用国际化,Struts 标签库与Tiles框架, JSTL标签库,Spring IOC; (4)采用优化性能技术,采用oscache缓存,freemarker静态页面生成; (5)...
项目整合完成后,开发者可以利用这个框架快速构建功能丰富的Web应用,同时享受到各组件带来的优势,如Struts2的控制层灵活性、Velocity的模板渲染能力、Tiles的页面布局管理、Spring的全面服务以及MyBatis的数据库...
2. **视图管理**:Struts的Tiles框架允许组合不同的JSP页面来创建复杂的视图,提高了界面的可复用性和可维护性。 3. **业务逻辑封装**:Action类作为业务逻辑的载体,调用Service层方法,处理请求并返回结果。 **...
- **插件扩展**:Struts 社区提供了大量插件,如Tiles、Struts Tiles2等,增强了布局和展示能力。 3. **Spring 和 Struts 集成**: - **Spring 作为依赖注入容器**:Spring 可以管理Struts中的Action和Service类...
5. **集成Struts1和Spring2**:使用Spring的Struts插件,将Spring管理的Bean注入到Struts的Action中,实现依赖注入。 6. **集成Spring2和Hibernate2**:在Spring的配置文件中,配置Hibernate的SessionFactory,并...
Spring的视图解析器(如Velocity或Tiles)可以与Struts2配合,实现更复杂的视图结构和模板复用。 6. **测试和优化**:整合后的系统需要进行充分的单元测试和集成测试,确保各个组件协同工作。此外,还可以根据需求...
《基于Spring+Struts+Hibernate的学生课程管理系统及SQL Server 2005数据库应用详解》 在现代软件开发中,企业级应用框架的使用已成为常态,以提高开发效率和系统稳定性。Spring、Struts和Hibernate这三大框架的...
"spring07"可能包含了一些关于Spring框架的第七个版本相关的配置文件或代码示例,这些内容可能涉及Spring的事务管理、AOP配置、数据源配置等,有助于更深入地理解如何在Spring环境中整合Hibernate和Struts2实现分页...
在SSH框架集成的项目中,Spring通常作为核心,负责管理其他组件,包括Struts的Action和Hibernate的SessionFactory。Struts处理HTTP请求,调用由Spring管理的业务服务层,这些服务又通过Hibernate与数据库进行交互。...
整合spring3 + struts2 + mybatis3 + tiles + dwr3 这几个流行的框架。 spring3,struts2,dwr3都是用的注解,tiles与mybatis是采用的xml配置。
一个典型的案例是使用Hibernate、Spring、Struts2和ExtJS这四大技术栈来构建一个图文管理系统。这个系统通常具备强大的数据持久化、依赖注入、MVC架构以及丰富的前端交互特性,从而实现高效且用户友好的功能。 ...
3. **Tiles**:Struts 提供了Tiles插件,允许开发者创建可重用的页面布局,提高了视图设计的灵活性。 **SSH集成**: Spring 和 Struts 的集成通常通过Spring的Web MVC实现,Spring作为控制层,负责业务对象的管理和...
- **Spring管理Struts和Hibernate**:Spring可以作为容器来管理和初始化Struts的Action及Hibernate的SessionFactory,实现统一的事务管理。 - **DispatcherServlet**:Spring MVC的前端控制器,负责拦截所有HTTP...
通过Struts处理请求,Spring管理依赖,Hibernate处理数据,Ajax提供异步交互,DWR和Dojo作为Ajax的工具库,共同构建出一个高效、动态的应用程序。这样的架构设计使得代码结构清晰,可维护性强,同时也提供了优秀的...
为了在项目中使用 Struts,你需要添加 Struts 的 JAR 包到项目的类路径中,包括 struts-core、struts-tiles、struts-taglib 等。同时,你需要配置 Struts 的核心配置文件 `struts-config.xml`,在这个文件中定义 ...
Struts提供了一组控制器组件和可重用的UI组件,如ActionForm、Action、Tiles等,使得页面跳转和请求处理更加规范和便捷。 **J2EE**(Java 2 Platform, Enterprise Edition)是Java平台的一个版本,专为构建分布式、...