
struts2
lianghyan
喜欢旅游,不喜欢固定一层不变的生活
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
第一个项目Struts2
好久好久不用struts了,今天开始重新复习一下。从头开始搭建struts。 第一步, 从http://struts.apache.org/2.3.4.1/index.html 下载struts2.3.4.1 第二步,从查看struts-2.3.4.1\src\apps目录下找到一个struts example项目拷贝到自己的web项目下,准备初始运行。需要初始的jar文件如下:原创 2012-10-17 10:49:08 · 628 阅读 · 0 评论 -
struts2 action 配置方法
struts2 action几乎完全吸收了xwork 的精华,近日学习struts 2,总结一下action的配制方法。首先看一下com.opensymphony.xwork2.Action的接口声明,Action提供execute() 方法,子类必须实现execute() 方法。 public interface Action { public String原创 2007-08-22 16:09:00 · 7033 阅读 · 2 评论 -
Struts2 Result Types
Struts2的action基类中提供了基本的result name的定义: String SUCCESS = "success"; String NONE = "none"; String ERROR = "error"; String INPUT = "input"; String LOGIN = "login"; 一个标准的result的设置 "success"原创 2012-10-19 11:16:00 · 2094 阅读 · 0 评论 -
Struts2 message resource
Action的resource bundle文件: 有与Action class相同的名字,如UserAction.java的资源文件为UserAction.propertiesmessage resource文件必须和action class放在同一个目录下不需要配置 UserAction.properties user.name=Hahaha user.role=Wowowow原创 2012-10-19 17:38:47 · 1302 阅读 · 0 评论 -
struts2 exception handling
Global Exception Handling /securityerror.jsp /error.jsp Exception Handling Per Action exceptionpage"/> /addUser.jsp /index.jsp exceptionpage">/userexception.jsp原创 2012-10-22 11:22:57 · 647 阅读 · 0 评论 -
Struts2 interceptor
看看com.opensymphony.xwork2.interceptor.Interceptor的定义 public interface Interceptor extends Serializable { void destroy(); void init(); String intercept(ActionInvocation invocation) throws原创 2012-10-24 15:19:30 · 1402 阅读 · 0 评论 -
Struts2 与spring结合
struts提供了一个struts2-spring-plugin-2.3.4.1.jar,实现了spring和struts的完美结合。在工程中引入该jar包 在web.xml配置加载spring配置文件的listener test contextConfigLocation /WEB-INF/applicationContext.xml;原创 2012-10-24 10:50:38 · 557 阅读 · 0 评论 -
Struts2 httpSession
Struts2 提供了一个将对象放入HttpSession的方法. 使用SessionAware package org.apache.struts2.interceptor; import java.util.Map; public interface SessionAware { public void setSession(Map session); }原创 2012-10-25 17:04:40 · 1320 阅读 · 0 评论 -
struts2 Preparable
Struts 提供了Preparable接口, prepare interceptor 会在Action 方法执行之前调用prepare()方法. 在prepare()方法执行之前之前,prepare interceptor 会调用prepare[ActionMethodName] 方法. package com.opensymphony.xwork2; public interface Pr原创 2012-10-26 14:23:02 · 699 阅读 · 0 评论