struts2

Struts2 + Sitemesh + Freemarker doesn't work

I've tried following every example i ccould find and i can't get struts2 + sitemesh + freemarker to work on a simple jsp. I have a very simple web.xml, a single action that just goes to index.jsp, and a simple .ftl decorator that just adds some text to the result. When i hit index.action, the page "seems" to be decorated, but I get the...

Conditional if in struts2 tags

I have the following code. <s:push value="#session['person']"> <s:if test="%{admin=='y'}"> <a class="add" href="/projit1/project/addProject.jsp">Create a Project</a> </s:if> </s:push> I am trying push an object person from session map to valuestack and check one of its properties admin's value. If...

How to use anchors instead of Submit button in Struts2 ?

I wish to use anchors instead of submit button in a struts tag form. Can I do it ? How should i create it ? please help ...

Struts2 jQuery plugin: trigger link on double click

I would like links to be trigger on double click. Something simple like this: <sj:a href="%{link}" targets="target" ondblclick="javascript: return true;" onclick="javascript: return false;">Bližnjica</sj:a> does not work (I guess because this is not a submit). Maybe some JS can do that? ...

Send mail from my web application

I have a feature in my web app like I have to send mails from the server to many email ids (some kind of notification stuff) my web application is implemented in struts2. Possibly I have to use javamail api i guess. I am completely new to this javamail and sending mail from server. what basic steps I need to do to setup a mail server in...

Testing injected dependencies into your struts2 actions

Hi, I am wondering how others might have accomplished this. I found in the Spring documentation @required which I attempted to use in a 'test' but got this stmt INFO XmlConfigurationProvider:380 - Unable to verify action class [xxx] exists at initialization I have found another way in spring to do this is to write custom init methods a...

File upload and Download in a web app using struts2

Hi In struts2 upload methods, can I choose where the uploaded file must be saved. I mean, all the examples in web ask me to store in WEB-INF which surely is not a good idea. I want to be able to store the uploaded file in any place in my disk. How should i do it? Can i do it with help of ServletContextAware interceptor ? When I use ...

get invalid.token result at the first time run action.

I use struts 2.1.8, I use <s:token> between <s:form> and </s:form> in my struts.xml like that ............ <package name="user" namespace="/user" extends="struts-default"> <action name="login"class="user.UserAction"> <result type="tiles">login.view</result> <interceptor-ref name="token"/> <interceptor-ref name="basic...

plz help me debug ( [OgnlValueStack] Error setting expression 'struts.token.name' with value )

I use <s:token> in my struts2.1.8 project, but I get log....., plz help me to solve, thanks in advance. 2010-03-13 09:26:06,224 INFO [STDOUT] (http-0.0.0.0-8080-3) 09:26:06,223 WARN [OgnlValueStack] Error setting expression 'struts.token.name' with value '[Ljava.lang.String;@5cfe5cfe' ognl.OgnlException: source is null for getP...

Comparing Struts 2 Nested Iterators

Suppose that I have two objects with the same property name that I am iterating over with Struts 2. class Book { // assume that there is a public getter and setter public String title; public List<Chapter> chapterList; } class Chapter { public String title; } In my JSP page, I want to iterate over the Book and Chapter. While ite...

Ajax Form Validation in Struts 2.1.8 using jsonValidationWorkflowStack

I'm trying to get the ajax validations working in my Struts 2.1.8.1 application. I'm not using any of the built in struts ajax tags so that makes things slightly more complicated but I've been following the directions here: http://struts.apache.org/2.1.8/docs/ajax-validation.html My problem is that the jsonValidationWorkflowStack is alw...

Struts2 <s:bean/> tag, used to instanciate a Parametric Bean

Hi, After looking a while other google, and the web, I decided to post my question here. The question is quite really basic, and simple : How do I use the struts2 tag <s:bean ... /> to instanciate a Parametric Bean ? For example imagine I have : public class GenericBean<T> { ... How will I instanciate this bean with a BeanType for...

struts 2 jquery plugin

i m using struts 2 jquery plugin in my portlet application.Its not working.Is there any other special to do for portlets...please help me... I kept the struts2 jquery plugin in web-inf/lib and when i am using the struts2 jquery tag it not working properly For ex: 1. i am using the datepicker tag the image is not displayed 2. When i am u...

Where can I find good Struts2 tutorial/references for beginners?

Hi, I am a beginner in Struts2. Can anyone can provide links to video or tutorials on Struts2 and Hibernate with netbeans, to give me a head start in this? Thank you very much. ...

Compare Long values Struts2

Hi everyone I'm trying to compare two values using struts2 s:if tag but its not working. If I hardcode the values it works but I want it to be dynamic. The variable stringValue is of type String. The variable currentLongValue is of type Long. <s:set var="stringValue" value="order"/> <s:iterator value="listTest"> <s:set var="currentLon...

How useful is a 'pure' MVC implementation?

I work at a company that provides custom made 'CRM'-like software. We are currently redesigning/redeveloping the software with the hopes that it will look more modern and be easier to develop and customize for future clients. Currently it takes a long time to customize each new application. There is a presumption that the reason it ta...

How to create a login with struts2 and LDAP/Active Directory?

Hi, I need to create a login and account validation using struts 2 and ldap/AD, so the flow would be: Display login page User inputs his username and password Validates user's existence in ldap/ad Redirect to welcome page with message and user's name How should I get it done in Struts 2 and Ldap/ad? Thank you. ...

Handling hundreds of actions in Struts2

Hi all, I've inherited a struts 1 web application where, in order to reduce the number of Action classes (I guess this is the reason), lots of actions are mapped inside a single Action class, like: public XXXAction() throws Exception{ actions = new Hashtable(); actions.put("/XXX/main/load", new Integer(0)); actions.put("...

What is the difference between Struts2 FilterDispatcher and StrutsPrepareAndExecuteFilter?

I saw some examples using FilterDispatcher, while others using StrutsPrepareAndExecuteFilter, in web.xml. May I know what is the difference between org.apache.struts2.dispatcher.FilterDispatcher and org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter? Thank you. ...

struts2 trim all string obtained from forms

Hi All, I develop web application using struts2. I want to improve getting string from forms. For this need trim all string and if obtained string is empty then set null to field. For this, I created StringConverter. public class StringConverter extends StrutsTypeConverter { @Override public Object convertFromString(Map conte...