struts2

Filter mapping for everthing to Struts2 besides one servlet?

I have a Struts2 (2.1.8.1) web application. My web.xml looks like, <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-m...

file upload problem in struts2

Hi , i want to upload a file and update result in other div on the same page dynamically just by showing a string "succeed/failed". It is working fine when i am forwarding result to a new page. However for below mentioned code it is updating div id "two" to [object HTMLDocument]. Please show me the way to solve it. <div id='two' style=...

Struts 2 Validation and Input fields repopulation

If I have the following struts.xml config: <action name="input"> <result>/jsp/input.jsp</result> </action> <action name="result"> <result>/jsp/result.jsp</result> <result name="input">/jsp/input.jsp</result> </action> And a simple form with only one field: <s:form action="result"> <s:textfield name="firstName" label="...

Is it possible to invoke a Servlet before showing index.jsp

I need to do some pre-processing logic which reside in my Struts2 Action class, before showing index.jsp when user access my Java web application for the first time. I tried using the below snippet in web.xml but it failed: web.xml: <welcome-file-list> <welcome-file>loginPage.action</welcome-file> </welcome-file-list> To summariz...

Advice on ASP.NET MVC to Java migration?

I'm an ASP.NET developer trying to learn Java web dev. I would like to migrate a small ASP.NET MVC site to Java. I have the ASP.NET code and the SQL Server database. I'm comfortable with Netbeans and Eclipse. I know the basics of servlets and JSPs. I'm wondering whether it would make sense to use a web framework instead of using JSP/...

How to override the XML handler in the Struts 2 REST plugin

Hi, I am working on a Java web app that uses Struts 2 with the REST plugin. By convention, any URL that ends with ".xml" will be sent through the XStreamHandler. This is fine--it's what I want in most cases. But in just a small number of cases I want to stream XML back to the browser. I know how to set up a @Result(type="stream") an...

struts2 tutorial

Where can I find some good video tutorials on Struts 2? ...

Tiles2 add scripts to a definition

Hi! I'm using struts2+tiles2, and I would like to do the following. I have a baseLayout, where I define my menu, body, etc like this: <tiles:insertAttribute name="menu" /> <tiles:insertAttribute name="body" /> And then in my tiles.xml I set them like this: <definition name="/index" extends="baseLayout"> <put-attribute name="...

Struts2 token interceptor using Ajax or multiple tabs

I'm using the token interceptor on my application, but I have encountered a problem with two case scenarios: 1 - When I submit the form using Ajax, the first time everything works perfectly, but the second time, the server sees that as a repeated token, which is okay, but I would like to know if I can avoid that without refreshing the p...

Weblogic and Struts2 FilterDispatcher problem

When deploying a Struts2 webapp on Weblogic 9.2 Multipack3, I always get: BEA-101165 Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher. I tested the application in other application servers (JBoss) and it works. Does anyone knows the cause and solution for this? ...

Why am I not getting Spring Security Login Error Messages?

Using Spring Security 3 along with Struts 2 and Tiles 2, I have a login page that appears when it is supposed to and performs the login as expected -- however when I enter bad user credentials I am returned to the login page with no information about what went wrong. I've checked all my configuration parameters and I can't see where the ...

How do I get the Spring Security SessionRegistry?

I can't seem to find how to get a reference to the Spring Security (V3) SessionRegistry inside of a struts action. I've configured the listener inside of my web.xml file: <listener> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> </listener> And I've tried to use the @Autowi...

java.lang.ClassNotFoundException: org.apache.struts.taglib.bean.CookieTei

i am finding java.lang.ClassNotFoundException: org.apache.struts.taglib.bean.CookieTei. i have already struts2-core-2.1.8.1.jar, struts2-json-plugin-2.1.8.1.jar on my classpath. ...

Struts program does not show properties value

i am try a program of Struts to show french value...for this i have define properties in message.properties file and in message_fr.properties files. but at run time when i access value of property it show blank space. i have include struts2-core-2.1.8.1.jar, struts2-json-plugin-2.1.8.1.jar on classpath. for example define in properties...

calculate in struts 2 tag ?

Hi. I have an iterate and i want to calculate sum of the values like this : <s:iterator value="myValues" status="myStatus"> <s:property value="value" /> </s:iterator> <s:property value="total.here" /> I want to show the sum of "value" in "total.here". Sorry for my bad english. Thank you very much. ...

using servlets in a struts 2 project

I am building an application using struts2. The web.xml file looks like below <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*...

Nasty java.lang.NumberFormatException in struts2 ognl

im getting this nasty exception, the problem is that i cannot control the get string since it's done by a 3rd party app. Apparently the number is too long to be parsed as int... java.lang.NumberFormatException: For input string: "1286579871769" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at j...

Label text based on the locale

I want to display the label name depending on the Locale (like English or French). I have two properties file: messages.properties: customer.name=Name messages_fr.properties: customer.name=Nom I have an array list in a Java class. In this list I want to store the values depending on the locale: arraylist.add(new ListItem("CustomerNam...

Why should I learn and use struts?

I'm a java developer, not seasoned, but I am familiar with most concepts reasonably well. I recently built a website using Tomcat/JSP (~30 dynamic pages). I made the newbie mistake of including large sections of core logic in the JSP, using the rationalization that it's "just a simple project". I learned the hard way. So I'm re-buildin...

struts.xml not working

Please some one tell tell me what is the problem in this code?? i have created a index.jsp where there is a link for "abhisek/showLogin.action" which will match with the action tag of the sruts.xml and perse the page to /pages/login.jsp. but i dont know why this is not happening please help me someone. i am giving the code here . i bukt ...