struts

Difference between Spring MVC and Struts MVC [closed]

折月煮酒 提交于 2019-12-03 02:59:22
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . What is the major difference between the Spring MVC and Struts MVC? 回答1: The major difference between Spring MVC and Struts is: Spring MVC is loosely coupled framework whereas Struts is tightly coupled. For enterprise Application you need to build your application as loosely

Struts2_ValueStack,OGNL详解

一笑奈何 提交于 2019-12-03 01:54:43
一、ValueStack 1 .ValueStack是一个接口,在struts2中使用OGNL(Object-Graph Navigation Language)表达式实际上是使用 实现了ValueStack接口的类OgnlValueStack.它是ValueStack的默认实现类. 2 .ValueStack贯穿整个action的生命周期,每一个action实例都拥有一个ValueStack对象,其中保存了当前action对象和其他相关对象. 3 .struts2把ValueStack对象保存在名为:struts.valueStack的request域中.即ValueStack作用域为request.当action创建的时候,ValueStack就创建了,action被销毁的时候,ValueStack就销毁了 4 .ValueStack中的数据分两部分存放:root(栈结构,CompoundRoot)和context(map形式,OgnlContext) (1) * 其中的root对象是CompoundRoot,CompoundRoot继承了ArrayList,提供了额外的方法:push(),和pop()方法, 用来对root对象中所包含的数据进行存取.正是由于这两个方法,CompoundRoot变成了一个栈结构. * struts2中,一个请求在最终到达Action的方法之前

Basic flow of Struts

时间秒杀一切 提交于 2019-12-03 01:45:21
问题 Well I want to study Struts so I am going to begin with Struts 1, I would like to know the general flow. What files are required? Whats the function of struts-config.xml? validation.xml? validation-rules.xml When you visit your JSP page, and an action gets fired, what happens? What does the Action and Form class do? Which class is called first when an action gets fired. I just downloaded a sample form, and all these files are confusing at first. I would like to know whats going on to get a

I'd like to learn Struts.Is there any good web sites or books? [closed]

和自甴很熟 提交于 2019-12-03 00:45:38
I want learn it for abc. And I'd like to know what's the difference between struts 1 and struts 2. Check this free book: Jakarta Struts Live Also here you can find some good basic code examples. For a Struts 1 vs. Struts 2 comparative, check this . Personal opinion. Jakarta Struts For Dummies is really a piece of art from newbies. It makes the shifting from jsp/servlet to struts so easy;) I haven't read the specific book, but I generally have good experience with Manning books, so I would recommend Struts 2 in Action . Also, I would generally recommend to start directly from Struts 2 as it has

Cross-site request forgery prevention using struts token

只愿长相守 提交于 2019-12-02 22:33:13
I want to implement Cross-site request forgery prevention for my web application which is base on struts 1.x framework. I know that struts 2 framework provide token interceptor for this and I can implement similar functionality using filters. I am bit confuse about few thinks 1 ) how I can generate unique token with straightforward way ? (can I use Action class token for this purpose which is use for avoiding duplicate form submission) Are there any issue in using struts 1.x framework token mechanism for CSRF Prevention Joseph Erickson The Struts 1 Action token methods work like the Struts 2

IDEA配置Struts框架

匿名 (未验证) 提交于 2019-12-02 21:53:32
对于刚接触编程的同学,对框架只是还不是很了解,本文主要介绍在Idea上配置Struts,实现简单的页面跳转,以及页面参数传递。 在进行代码编写之前先对Idea进行一个简单了解,对于长时间接触编程的,对于Eclipse或者MyEclipse并不陌生,想当初刚接触编程的时候配置Eclipse运行环境花费了大量的时间,但作为一个程序员来说,我还是建议大家尽量运用Idea,举一个简单的例子,在Idea中进行Debug,那是很简单的,只需要在代码进行点击,就可以直接进入Debug状态,对于整个进程的参数都可以看得到,一目了然,这只是一个简单的一个功能,还有很多等待着小伙伴去探索,我是感觉用了Idea就不想用Eclipse了,闲话说到这,下面看代码,首先解释一下,我用的是Idea社区办2016.3 一、Struts简单介绍 ① 首先Struts是一个MVC框架,是Apache的一个开源框架,感觉哪里都有Apache这个组织 ② Struts 2以WebWork为核心,采用拦截器的机制来处理用户的请求 二、Struts工作流程 ① 客户端(浏览器)发送请求 ② 请求通过http协议发送给服务器 ③ 服务器对请求进行拦截,这个是在web.xml文件中进行配置 ④ web.xml文件对struts.xml文件映射 ⑤ 映射到指定的action,返回resoult ⑥

Cannot find the tag library descriptor for /WEB-INF/struts-html.tld in Struts

六眼飞鱼酱① 提交于 2019-12-02 21:38:45
问题 I am new to the Struts framework and while developing a simple Struts 2 application I'm getting the following error: Cannot find the tag library descriptor for /WEB-INF/struts-html.tld How do I fix this error? 回答1: struts-html.tld is a TLD for Struts 1 tags. Struts 2 uses a single TLD, struts-tags.tld , and it's in the struts2-core-2.x.x.jar . You can declare it as follows: <%@ taglib prefix="s" uri="/struts-tags" %> There are other TLDs like struts-dojo-tags (deprecated in 2.1), struts

Getting extension check(hardening) alert while opening a .xls file using Office 2007/2010

跟風遠走 提交于 2019-12-02 21:33:31
问题 I am working on a struts based web application. In that application, we generate and download xls file from Jsp. In Jsp file and web.xml, I have set the content-type as "application/vnd.ms-excel" it seems xls files generated by the jsp pages are not real excel files, but a text format that is understood by the MS Excel. Hence excel opens the files and displays the output similar to excel files saved by MS Excel. Since newer versions of MS Office 2007/2010 checks the file extension and the

3.2 Struts2基本应用及工作流程

狂风中的少年 提交于 2019-12-02 21:04:13
struts2流程 *.action--> web.xml( 过滤器)--> struts.xml --> Action.java --> JSP等 3.2.1 简单Struts 2实例开发 1.建立一个Web项目 命名为“ Struts2 ” 2.添加Struts 2框架支持 用MyEclipse添加Struts2支持,项目右键->MyEclipse->Project Facets[Capabilities]->Install Apache Struts(2.x ) Facet,然后在弹出窗口中点击Finish即可。(我这是mac版的Myeclipse 2014,如果是Win版的Myeclipse8.5,是右键项目->MyEclipse->Add Struts Capabilities...,然后在弹出窗口中选择Struts版本为2.1,点击Finish即可)。如果更早版本的MyEclipse 没有对Struts 2的支持,也可以去官网下载Struts2(http://archive.apache.org/dist/struts/) 。我这里用的版本是2.2.1。 将下载的Zip文件解压缩,是一个典型的Web结构。包含以下4个文件: apps:包含基于Struts 2的示例应用,是学习Struts 2非常有用的资料。 docs:包含Struts 2的相关文档,如Struts

ActionContext和ServletActionContext的区别

元气小坏坏 提交于 2019-12-02 21:02:51
什么是MVC 1.Model模型 模型的职责是负责业务逻辑,包含两部分:业务数据和业务处理逻辑.比如实体类, DAO,Service都属于模型层 2.View视图 视图的职责是显示界面和用户交互(收集用户信息)。属于视图的类是不包含业务 逻辑和控制逻辑的JSP 3.Controller控制器 控制器是模型层和视图层之间的桥梁,用于流程控制。比如我们之前项目中的ActionServlet 写Struts2所需要的控制器配置文件struts.xml非常重要,该文件写请求与各个Action的对应关系, 前端控制器会根据配置信息调用对应的Action(Java类)去处理请求 注意事项: a.在编写struts.xml放在src目录中,而部署后该文件位于WEB-INF/classes中 b.同样的,.properties文件也放在src下,部署后也在WEB-INF/classes/下 c.程序一启动,struts.xml就会被加载到内存,并不是现读的 d.程序一启动,struts.xml就会被加载到内存,并不是现读的. Struts2提供的方便之处 1.数据的自动封装(输入属性) 根据页面组件的name属性,自动给Action中的属性赋值 2.数据的自动传递 Action中的属性在JSP页面可以直接用EL表达式拿到,即自动调用某属性的get方法 Struts2对EL表达式的支持