struts

How to integrate an old Struts application with Spring 3.x

∥☆過路亽.° 提交于 2019-11-30 07:37:10
问题 i was wondering how to and what the prefered way of integrating an Struts 1.x application with Spring 3.x so we can benefit from the IOC stuff. 回答1: Use ContextLoaderPlugin and set the struts controller to the processorClass "AutowiringRequestProcessor" like this (in struts-config.xml): <controller> <set-property property="processorClass" value="org.springframework.web.struts.AutowiringRequestProcessor" /> </controller> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

struts action singleton

元气小坏坏 提交于 2019-11-30 06:42:58
问题 Why is the struts action class is singleton ? Actually I am getting point that it is multithreaded. but at time when thousand of request hitting same action, and we put synchronized for preventing threading issue, then it not give good performance bcoz thread going in wait state and it take time to proced. Is that any way to remove singleton from action class ? for more info Please visit : http://rameshsengani.in 回答1: You are asking about why the Action class is a singleton but I think you

Populate Collection from Struts2 Form Submission

廉价感情. 提交于 2019-11-30 05:27:57
I'm trying to populate a List of beans from a form: public class Foo { public String attr1; public String attr2; } public class Bar { public List<Foo> foos; } public class StrutsAction extends Action { public Bar bar; } So in my Struts2 form, what's the best way to populate Foo? Intuitively, I want to do: <input type="hidden" name="bar.foos.attr1" /> but that isn't working and would cause collisions. I'm sure the answer is very simple and I'm overlooking it. Roy Chan If I understand it correctly, you just want different name for each hidden field? <s:iterator value="bars" status="key"> <s

How to get the original request url from a servlet/jsp after multiple servlet forwards

对着背影说爱祢 提交于 2019-11-30 04:25:03
I am working on a cruise booking app using struts/tiles that uses multiple internal servlet/jsp forwards to reach the right jsp for display. But, once you reach the final jsp that is used to render the page, the ${pageContext.request.requestURL} call in that jsp returns the path of this jsp. For example Original request: /booking/getCruiseDetails gets forwarded to: /booking/validateCruiseDeteails.jsp gets forwarded to: /booking/validateUser.jsp finally gets forwarded to: /booking/showCruiseDetails.jsp So, in /booking/showCruiseDetails.jsp when I call ${pageContext.request.requestURL} I get

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:

最后都变了- 提交于 2019-11-30 03:46:18
I am creating web application using Spring, Hibernate, Struts, and Maven. I get the below error when I run mvn clean install command: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.project.action.PasswordHintActionTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.project.action.PasswordHintAction com.project.action.PasswordHintActionTest.action; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No

Get current filename in JSP

江枫思渺然 提交于 2019-11-30 03:20:34
Is there a way to get which JSP is currently rendered, with JSTL or Struts (or without)? like _ _ file _ _ in Python and PHP? Aaron Digulla Well ... yes ... in a way String __jspName = this.getClass().getSimpleName().replaceAll("_", "."); I'm using a JSP called pre.jsp for that which I include at the top of each JSP in my webapp: <%@page import="org.apache.log4j.Logger"%> <% String __jspName = this.getClass().getSimpleName().replaceAll("_", "."); Logger log = Logger.getLogger(this.getClass().getName()); log.info("BEGIN JSP "+__jspName); %> <!-- BEGIN <%=__jspName %> --> Plus I put this at the

Prevent IE caching

非 Y 不嫁゛ 提交于 2019-11-29 22:27:57
I am developing a Java EE web application using Struts. The problem is with Internet Explorer caching. If an user logs out he can access some pages because they are cached and no request is made. If I hit refresh it works fine. Also if an user goes to login page again it won't redirect him because that page is also cached. Two solutions come to my mind: Writing an Interceptor (servlet filter like) to add to response header no-cache etc. Or or put <meta> tags at each page. Which one should I do? BalusC Rather set the following headers on the HttpServletResponse of the page(s) in question so

Why use 'redirect=true' in struts 1.* forward?

妖精的绣舞 提交于 2019-11-29 21:31:45
I've been having some problems with ActionMessages created during execution of an action which didn't display, and I found out that my problems were due to my forwards having redirect=true in struts-config.xml. Since the default behavior is redirect=false , I've been thinking about which benefits can one have using redirect=true and I couldn't find any answer. Does anyone know when and why redirect=true should be used in action forwards? it prevents the 'double submit problem' Never show pages in response to POST Always load pages using GET Navigate from POST to GET using REDIRECT more on this

Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]

試著忘記壹切 提交于 2019-11-29 18:10:57
I m trying to port my hibernate example to spring by using spring hibernatetemplate but i m getting this error Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]. Please suggest me run my project. I m fresher in my company my web.xml file <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <welcome-file-list> <welcome-file>index

Confusion in Struts MVC architecture

隐身守侯 提交于 2019-11-29 16:55:57
I am studying the Struts2 in Action and come to know that Controller in Struts2 is FilterDispatcher and Model is Action. But previously I knew that Action and FilterDispatcher both are Controller and Struts does not provide support to model layer. Which one of the above is wrong? I would say that FilterDispatcher is a FrontController and Action is both Model and Controller in one class. Actually Struts2 actions are controller delegates. And Struts2 provides a value stack on the view layer which has better support, and if you want to use a pseudo-model then action should implement ModelDriven