struts2

How do I render an array of Java beans to XML with struts2?

My output should be something like this: <result> <item> <id>123</id> <src>123</src> <dst>123</dst> </item> <item> <!-- ... --> </item> </result> And the action class would have a method getFoos which returns an array of uniform objects, e. g. like this: class Foo { // ... public long getId() { ... } // .....

Multiple field ognl type converter

I have a form with (at the moment) two fields and submit the following: capture.id = 213 capture.description = DescriptionText The target object 'capture' is immutable and I would like to provide a type converter to take both values and call the constructor. What I cannot seem to do is get by TypeConverter to be invoked. If the input...

reading Struts2 tag values in javascript

Hello, I am using struts2 with jsp. In Jsp, i have a table in which few rows of data are present. I have used iterators to display row data of table. Each row contains a button to update the row data(like priority of row data). I am trying to use javascript to update row data when a button is clicked. I am not able to access the...

Struts2 Validation - No Validation on Input

Every tutorial I have found on Struts2 Declarative validation explains how to make the fields validated which is nice and easy. But how do you enter the page with out it being validated? I have the below Action mapped <package name="admin" namespace="/admin" extends="struts-default"> <action name="display_*" class="action.admin...

How to configure result types in struts2 (webwork)

I'm writing a new result type for struts2 (aka webwork) and I can't figure out how to configure the result type. The configuration should include stuff like TEMPLATE_PATH or REFRESH_INTERVAL etc, e.g. those are global configuration options per the result type, not per specific action. The result configuration looks like that: <result-ty...

<s:select> Error:The requested list key 'typeSurvey' could not be resolved....

this is my jsp: <s:form action="InsertSurvey"> <table> <tr> <td> ID Survey: </td><td><s:textfield name="SurveyValues.survey.idtextsurvey"/> </td> <td> Tipo Survey: </td><td><s:select list="typeSurvey"/> </td> </tr> </table> </s:form> and this is my action wit...

Performance issue using <s:bean/> tag

I seem to be having a performance issue in some of my Struts 2 actions. On several of my pages, I render a couple of drop down tags in my output page. I populate the drop down tags by instantiating an tag and invoking the methods in the bean to call an EJB service and populating a collection property from the results. The collection is...

Popular IDE for Struts 2

I'm beginning to learn Struts 2, and am wondering: Which is the most popular IDE for Struts 2? I've looked at a few of them (netbeans, idea, eclipse) and only idea seems to treat Struts as a first class citizen. But the community version of idea doesn't have this capability. The others have third party plugins to support it but it doe...

Setting the content-type of a response in Struts2

So, I'm using freemarker templates with Struts2 to formulate my responses. However, since I'm trying to use taconite as well, I need the response to be sent with the content type of "text/xml". I can't seem to find a way to use freemarker directives to set the content type, and I am not well versed enough in struts to know if there is ...

Prevent IllegalStateException when reading from request

I have an interceptor for catching Exceptions and sending emails of this exceptions. All my struts actions extend CoreController which implements SerlvetRequestAware. In mail service class then I have: CoreController cc = (CoreController)invocation.getAction(); HttpServletRequest request = cc.getRequest(); I want to insert request b...

Infinite loop occuring while using <s:action struts2 tag

Hi Is there any solution to the following Struts 2 issue yet? link text Thanks Chaitanya ...

Iframe not showing object from struts action class.

Hi all, This is in continuation with my previous question which was not framed properly. I have an iframe in a jsp class which is calling a struts2 action class in its src, but instead of opening inside the frame the file is getting downloaded, Inside file TempContentPage.jsp: <s:form> <iframe id="displayFrame" src="ContentPage.actio...

Struts2 multiple files upload with a twist

Let's say I have the following model classes package com.example.model; public class Product { private int productId; private String productName; //Getters and setters } package com.example.model; public class ImageTypes { private int imageTypeId; private String imageLocation; private String description; ...

Add Principal/authority dynamically for anonymous user

Hi Guru, I am using spring security 2.x (+spring + struts2) and would like to enable add authority to user dynamically after user submits a form. I have a protected directory (/protected/dir/) which is protected by ROLE_USER <sec:intercept-url pattern="/protected/dir/**" access="ROLE_USER, ROLE_ADMIN" /> Which user can access after ...

Required help for strut2

Hi I had called action after submitting form. But before calling "return success" from action I need to call the same execute method of the same class of same application but running in different tomcat with all request parameters. How can I do this? ...

how to solve lock_wait_timeout, subsequent rollback and data disappeareance from mysql 5.1.38

i am using a toplink with struts 2 and toplink for a high usage app, the app always access a single table with multiple read and writes per second. This causes a lock_wait_timeout error and the transaction rolls back, causing the data just entered to disappear from the front end. (Mysql's autocommit has been set to one). The exception ha...

Struts2: Radiobutton, Iterations and List trouble

Hi at all... I have a complicated problem and I hope to explain it clearly possible... I have 2 list. On my jsp I have a nested iteration with this 2 lists, inside this there is a tag. This is the code: <s:iterator value="listSurveyToRender" var="s" status="counterS"> <s:iterator value="listSurveyValuesToRender" va...

Action tag is forced to use input result if outer action has action errors

I use Sitemesh as template engine with Struts2. In my decorator jsp file, I use for division content source. Now I encounter a problem that if an action has an action error, there will be a "input" result used. It will cause all in decorator JSP file also execute input result directly. That's means method won't be called. How do I ma...

Integrating Spring LDAP (Acegi) using Struts 2 RolesInterceptor

Acegi provides ExceptionTranslationFilter for handling authentication or access denied exceptions. We can use Struts 2 RolesInterceptor raise these exception and there by delegating authentication and authorization to Acegi. RolesInterceptor checks using isUserInRole method in the servlet request and calls handleRejection method. Securi...

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no language-specific? And how can that exception later be displayed based on the current locale? I was originally looking for a way to localize the...