struts

Struts

陌路散爱 提交于 2019-12-28 17:34:55
Struts2简介 Struts2是一个基于MVC设计模式的Web应用框架,它本质上相当于一个servlet,在MVC设计模式中,Struts2作为控制器(Controller)来建立模型与视图的数据交互。 Struts 2是Struts的下一代产品,是在 struts 1和WebWork的技术基础上进行了合并的全新的Struts 2框架。其全新的Struts 2的体系结构与Struts 1的体系结构差别巨大。 Struts 2以WebWork为核心,采用拦截器的机制来处理用户的请求,这样的设计也使得业务逻辑控制器能够与ServletAPI完全脱离开,所以Struts 2可以理解为WebWork的更新产品。 web框架的特点 都是基于前端控制器模型来设计的,浏览器发送的所有的请求,都需要经过前端控制器,前端控制器再根据具体的请求所要实现 的功能,分发到不同的action来处理,所有的分发操作都是框架自动帮你完成的,我们只需要关心数据怎么样处理,封装,接收这些都不用管,其余的操作都是前端控制器来帮你完成 前端控制器是通过过滤器来实现的,过滤器当中会有接收数据,封装数据,把所有的东西都帮你处理好,最后到action当中就可以直接使用了 Struts的基本使用 下载struts框架 下载struts官网 对下载下来的struts的目录进行介绍 创建Java Web项目并引入相应的jar包

test the localhost in android emulator

自闭症网瘾萝莉.ら 提交于 2019-12-28 04:51:15
问题 My web application runs in localhost server. In my emulator the URL is http://localhost:8080/myaction Is it possible to retrieve the information from the server? 回答1: Localhost is device's own loopback interface, if you're trying to access your development machine use 10.0.2.2. More about it here. 来源: https://stackoverflow.com/questions/2234742/test-the-localhost-in-android-emulator

Struts2 拦截器 Interceptor结构

走远了吗. 提交于 2019-12-26 17:16:30
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Interceptor结构 让我们再来回顾一下之前我们曾经用过的一张Action LifeCycle(生命周期)的图: 图中,我们可以发现,Struts2的Interceptor一层一层,把Action包裹在最里面。这样的结构,大概有以下一些特点: 1. 整个结构就如同一个堆栈,除了Action以外,堆栈中的其他元素是Interceptor 2. Action位于堆栈的底部。由于堆栈"先进后出"的特性,如果我们试图把Action拿出来执行,我们必须首先把位于Action上端的Interceptor拿出来执行。这样,整个执行就形成了一个递归调用 3. 每个位于堆栈中的Interceptor,除了需要完成它自身的逻辑,还需要完成一个特殊的执行职责。这个执行职责有3种选择: 中止整个执行,直接返回一个字符串作为resultCode 通过递归调用负责调用堆栈中下一个Interceptor的执行 如果在堆栈内已经不存在任何的Interceptor,调用Action Struts2的拦截器结构的设计,实际上是一个典型的 责任链模式 的应用。首先将整个执行划分成若干相同类型的元素,每个元素具备不同的逻辑责任,并将他们纳入到一个链式的数据结构中(我们可以把堆栈结构也看作是一个递归的链式结构)

Send value from 1 jsp to another jsp

好久不见. 提交于 2019-12-26 14:36:12
问题 I have 1 JSP, say 1.jsp in which I have a value which am getting from request.getAttribute("testvalue") from action class, as I am using Struts framework. I need to send this value from 1.jsp to another 2.jsp . Please let me know how to do this? Also going ahead,i need to send this value from 2.jsp to 3.jsp . Am trying to avoid using setting the value in session. So let me know how to do this? 回答1: Getting value from the request, you should be putting a value to a request. This code request

performance issue to load huge records in a single jsp page

坚强是说给别人听的谎言 提交于 2019-12-25 13:14:47
问题 I stored huge(above 20000) records in StringBuffer for displaying in a jsp. I used StringBuffer to store in servlet and pass this as request attribute to jsp. The problem is that it takes too mush time to load all the records. After loaded, the browser is getting slow. Is there any best way to load huge records in a single jsp page ? or otherwise how to read data from StringBuffer fastly? 回答1: I'm pretty sure the problem doesn't come from the StringBuffer or from the HTML code generation by

Can't access property in returned object

馋奶兔 提交于 2019-12-25 07:48:03
问题 I've got a problem where I can't seem to query my JSON coming back, I can print out the entire response though, here's my JSON response, I can only see this when I do a msgBox() prompt: { "Addresses" : "[{ Building=Megatron Skyscraper, BuldingId=1998, AccountId=2000, Number=007, Name=Megatron },{ Building=StarScream Skyscraper, BuldingId=1999, AccountId=2001, Number=008, Name=StarScream }]"} And here's my code: function getReadyStateHandler(req) { // Return an anonymous function that listens

Accessing value from bean:write in value attribute of logic:equal Struts

陌路散爱 提交于 2019-12-25 07:29:51
问题 I'm developing an application using Struts 1.3.10 I need to iterate 2 lists in order to print the result in jsp. The first list iteration needs to be used to select elements from list 2. For that reason I'm trying to do like this: <logic:iterate name="bodyForm" property="domainList" id="domList"> <div><h1><bean:write name="domList" property="domain"/><h1> <ul> <logic:iterate name="bodyForm" property="locationsList" id="locList" > <logic:equal name="locList" property="domain" value="<bean

Can struts 1.1 post to a relative path

ぐ巨炮叔叔 提交于 2019-12-25 04:55:25
问题 I have a Struts application and I build by form <html:form action="companyProvAdd"> ....</html:form> which renders the html as <form name="companyProvAddForm" method="post" action="/ebig/companyProvAdd.do"> ...</form> Is there a way to have the post go to a relative URL? <form name="companyProvAddForm" method="post" action="companyProvAdd.do"> ...</form> 回答1: It looks like Struts 1.1 does not support this https://issues.apache.org/jira/browse/STR-768 but I did find a workaround <!-- <html

Source Code fir Tiles struts-tiles2-1.4.0-SNAPSHOT

Deadly 提交于 2019-12-25 04:26:41
问题 I am not able to find the source code of struts-tiles2-1.4.0-SNAPSHOT.jar version of tiles. The jar files are present at http://people.apache.org/~pbenedict/struts-osgi/org/apache/struts/struts-tiles2/1.4.0-SNAPSHOT/ location. 回答1: While choosing a Struts2 Tiles plugin, you must ensure it is the one designed for your version of Tiles ( 2 or 3 ), and it is the exact version of your Struts2 JAR ( 2.3.16 , for example) List for Tiles 2: Struts 2 Tiles 2 Plugin List for Tiles 3: Struts 2 Tiles 3

Is it posible to change upload path with a servlet?

倾然丶 夕夏残阳落幕 提交于 2019-12-25 04:12:35
问题 I'm gonna try to explain what I want to do here and why I need to do it this way. I know I can redirect my inside of context paths to outside of context paths using a servlet like the next that I got somewhere around here, which works beautifully: @WebServlet("/images/*") public class ImageServlet extends HttpServlet { // Properties --------------------------------------------------------------------------------- private String imagePath; // Init ----------------------------------------------