struts2

Spring MVC equivalent for Struts 2 Preparable

Is there something similar to Struts 2 Preparable interface / prepare method in Spring 3 MVC? That is, a method executed every time the controller is requested. Thanks. EDIT: What I want to achieve, for example, is to fill a group of properties depending on the user I am, for every request in this controller, trying to avoid this: @C...

ajax in Jquery & struts2 action sample

Hi i am new to struts2 and ajax. I want to verify the userInputs before submission by querying from the database. So i planned to implement Ajax.based on the validation it will return one simple message for dialogue box.Please provide sample for me to proceed. ...

Struts2 Configuration Understanding

Hello All... Recently I am going through with one tutorial for Struts2 UI Tags. So, I found that example and execute it with perfection. But, in the struts.xml configuration file, I couldn't understand some of the OGNL expressions. That I am writing here : <struts> <package name="default" extends="struts-default"> <action ...

Using annotations to return custom results in struts2

I know that you can return custom objects using struts2 by specifying a declaration in your struts.xml file. I've done that, gotten that to work. What I want to do is move away from that, and accomplish the same thing via annotations. If I have an action that is going to return a custom result type I would like to be able to do it. ...

ActionContext doesn't populate my variables

Hey Everyone, This one has me really stumped. I'm developing a web app for tomcat 6 and using struts2. I have an action that gets some variables from the ActionContext. The strange thing is that the variables, sometimes, don't get set the first time I try to assign them. The code looks like this... results = (List) ActionContext.getCo...

How to call Struts2 Action method in ajax?

How to call Struts2 Action method in ajax.Still now i worked to call servlet.is there any possibilities?if so please do share. ...

Struts 2 Action Methods

Time for yet another stupid question, adding to a long line of them. I'm a newbie with Struts 2, having spent years using old 1.X. Struts 2 actions can be roughly equivalent to Struts 1 DispatchActions, simply by adding methods (and defining them in struts.xml). So, suppose I have this method: public String create() throws Exception {...

Problem with struts 2 and json plugin

I'm using the json plugin that comes with struts 2 (json-lib-2.1.jar) and trying to follow the website to set it up. Here's my struts.xml <struts> <package name="example" extends="json-default"> <action name="AjaxRetrieveUser" class="actions.view.RetrieveUser"> <result type="json"/> </action> </package> </st...

How do i adjust the label width n make it bold ? in the jsp of Struts2 aplication ?

Hi I have an struts2 application with jsp pages where i have struts2 tags something like this <s:form action="contactus.action" method="post" name="ContactUs Form" > <s:textfield name="cust.fname" key="fname" size="25" maxlength="20" required="true" /> <s:textfield name="cust.lname" key="lname" size="25" maxlength="20" requ...

Struts2 + Freemarker + DisplayTag: how to make it work

I am currently upgrading our application from Webwork to Struts2. Today I run into strange error: displayTag stopped working after the upgrade. This is a snipped from my FTL file: <#assign display=JspTaglibs["http://displaytag.sf.net"]> <@s.set name="entries" value="historyEntries" scope="page"/> <@display.table class="data" name="p...

Validation of certain Action's methods in Struts2

Hi All, I have an Action class with CRUD actions inside and I have overridden the validate() method given by the ActionSupport class. The question is: how can I fire the validation only for the update and create actions? One possible solution is to move create & update on a brand new Action class, but I'd like to know if there's anot...

Restricting access to URLs in Struts 2

Is it possible to restrict access to certain URLs in Struts 2? I already have it so you can't access jsp's directly, but you can access them indirectly. For example if I have a jsp "blah.jsp" I can access it by typing "/blah" and if I don't have an Action called Blah.java, it will automatically go to the result, blah.jsp. Most of the ...

struts2, problem with oc4j

Hi, I am having trouble using urlrewrite with oc4j (10.1.3.1). It works perfectly on tomcat (6.0). I am not able to forward to struts2 actions. My web.xml: http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Blank</display-name> <filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class>org.tuckey...

Problem with Struts 2 Convention plugin and package-info.java

I'm using struts 2 with convention plugin. The convention plugin page states for the ParentPackage annotation, "To apply this annotation to all actions in a package (and subpackages), add it to package-info.java." I have two packages, my-default and my-secure. I have a package called actions.secure and in it I have a package-info.java...

Spring/Struts 2 Configuration - any dummies' guide??

I'm a beginner in practical real-world java programming. I don't really understand these basic things in Spring - using it for jdbc calls (without any ORM), mail api, configuring logger. I think, I got a bit scared with the configurations (long, time-consuming) that're required to get these things working. Can anyone recommend dummies ...

What am I going to lose if I use DOJO and not YUI

I am working on a Struts 2 application. I see that Struts 2 uses DOJO for Ajax support and UI components (some are Tabbedpanel, tree etc). I wanted to know what advantage am I going lose in YUI thats not available in DOJO if I proceed in this way. ...

iterator in strut 2.0

I used iterator in my strut application like s:iterator value="resultList" id="resultData" status="stat" > s:hidden name="orderItemsList[%{index}].totalCostPrice" id="%{#costPriceId}" value="%{#resultData.totalCostPrice}"/> /s:iterator> here,I got an error when its found totalCostPrice value 0(Zero). ...

Struts2 with Rest and Tiles

Hello I try to create a struts2 based webapp that is using the rest-plugin and the tiles-plugin together. This works fine for me exept when i using validation. I have a login Exception with an create method for the validation like this. @Validations(requiredStrings = { @RequiredStringValidator(type = ValidatorType.FIELD, fieldN...

Filters vs Interceptors in Struts 2

What's the difference, really, between filters and interceptors? I realize that interceptors fire before and after an action, recursively, and filters can be configured to fire on actions and on certain url patterns. But how do you know when to use each one? In the book I'm reading on Struts 2, it seems that interceptors are being pus...

Struts2 - Showing validation errors on page

I'm using simple theme in my struts2 application. In my action's validate() method, if i add validation error messages using addFieldError(fieldName, message), the error message is not showing up in my view page. I guess this is because I use the simple theme. So, how do I show struts2 validation errors in my screen? ...