Struts2.0(Java)
Struts2.0
Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining applications over time.
Apache Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts communities joined forces to create Struts2. This new version of Struts is simpler to use and closer to how Struts was always meant to be.
Homepage: http://struts.apache.org/2.x/
struts2上iterator标签的例子
在struts2中,iterator标签是很好用的,但也要注意一下.举个例子, 如果要在每行中只显示两条记录,这个经常用到的例子来的了,可以这样用: <table width="800px" align="center"> <tr> <s:iterator value="songs" status="st"> ...
struts2 iterator标签分析
iterator标签主要是用于迭代输出集合元素,如list set map 数组等,在使用<s:iterator/>标签的时候有三个属性值得我们关注 1. value属性:可选的属性,value属性是指一个被迭代的集合,使用ognl表达式指定,如果为空的话默认就是ValueStack栈顶的集合. 2.id属性:可选属性, 是指集合元素的id 3.status属性:可选属性,该属性在迭代时会产生一个IteratorStatus对...
struts2 标签s:if
struts2 的web 项目中为了方便的编写jsp,标签是最好的选择 1:struts2 标签库的定义在**-core-版本号.jar META-INF 路径下找到struts-tags.tld文件;使用该标签需要在web 项目里面导入标签库: A:在web.xml文件 (默认 可以省略) attrValueId和countAll 在s:iterator域内这是id的值是"id",使用ognl读取遍历对象的方法是 #i...
Struts2上Session的使用用法
Struts 2 中Session的用法 在ActionSupport子类的execute方法中存储session Map session = ActionContext.getContext().getSession(); session.put("logged-in","true"); 同样在execute方法中,可以清除session变量 Map session = ActionContext.getContext().getSession(); session.remove("logged-in"); &nb...
Struts2获得session和request方法介绍
在struts1中,获得到系统的request或者session对象非常方便,都是按照形参传递的,但是在struts2中,request和session都被隐藏了 struts提供两种方式访问session和request,其中比较常用的是利用SPRING里面所说的IOC即控制反转 IOC方式: action类实现ServletRequestAware接口,并新建一个HttpServletRequest request public class UserLoginActio...
struts2 action的几种配置方法
struts2 action几乎完全吸收了xwork 的精华,近日学习struts 2,总结一下action的配制方法。首先看一下com.opensymphony.xwork2.Action的接口声明,Action提供 execute() 方法,子类必须实现execute() 方法。 public interface Action { public String execute() throws Exception; } com.opensymphony.xwork2.Act...
struts.properties中定义的Struts 2属性
struts.properties中定义的Struts 2属性: struts.configuration 该属性指定加载Struts 2配置文件的配置文件管理器.该属性的默认值是org.apache.Struts2.config.DefaultConfiguration, 这是Struts 2默认的配置文件管理器.如果需要实现自己的配置管理器,开发者则可以实现一个实现Configuration接口的类,该类可以自己加载Struts 2配置文件. struts.loca...
Struts2中使用SiteMesh插件
通过使用SiteMesh插件,就可以在Struts2应用中使用SiteMesh装饰器页面来统一应用程序所有页面的显示风格。实际上,在Struts2中使用SiteMesh非常简单,因为Struts2将所有的值都保存在Stack Context或ValueStack中,因此在SiteMesh页面中使用Struts2的标准标签即可。 1 安装SiteMesh插件 与整合其他框架类似,Struts2与SiteMesh框架的整合也使用了插件方式进行...
Struts2.0登陆小例子
这几天没事,看这论坛里都在谈struts2,所以也起了好奇心, 自己做了一个简单的登陆,实现了从login.jsp,提交数据给服务器,服务器判断提交的数据是否为用户名:"zhangsan",密码: "lisi",如果是就显示"zhangsan ,欢迎登陆.,还有就是支持中文显示,给大家一个参考...接触时间不长,请大家多提意见... 先去官方网站上下载struts2的jar包...
Struts2拦截器的使用
如何使用struts2拦截器,或者自定义拦截器。特别注意,在使用拦截器的时候,在Action里面必须最后一定要引用struts2自带的拦截器缺省堆栈defaultStack,如下(这里我是引用了struts2自带的checkbox拦截器): <interceptor-ref name="checkbox"> <param name="uncheckedValue">0</param> </interceptor-ref&g...