struts2

Struts2 validation of indexed textfields possible?

Hello. What is the correct way of validating indexed textfields with the built in validation framework in Struts2? For example sth. like: <s:textfield key="names[0]" /> <s:textfield key="names[1]" /> <s:textfield key="names[1]" /> I don't want to replicate all the simple built in validators just for validating such simple indexed ...

give suggestion data display base on the Locale Click to flag this post

<s:iterator value="listObject"> <s:component template="abc.vm"> <s:param name="text" value="listValue" /> <s:param name="prefix" value="listIndex" /> </s:component> </s:iterator> listObject is a LinkedList object. listValue and listIndex is of Object type. i have two properties file: messages.properties: activity.nam...

Is it possible to generate form fields in a webapp from a list of generic objects?

Here's the situation: We want to have a Search page that takes in an ordered list of Attribute objects, and based on their 'type' (text input, dropdown, checkbox) generates and displays it in the appropriate manner. We'd also need to process the values for these fields in order to filter results. I'm at a loss for how we can accomplish t...

using internationalization on list data

i am using Struts2 in application. <s:iterator value="listObject"> <s:component template="abc.vm"> <s:param name="text" value="listValue" /> <s:param name="prefix" value="listIndex" /> </s:component> </s:iterator> listValue is a values of list. i am using iterator to traverse the list. now on listValue, i want to put here in...

Why would background: url() redirect to the image?

I'm using Struts2 w/ SiteMesh. In my CSS I have the following line: #top_nav { background: url('../images/menu_tile.png') repeat-x 0 0 ; height: 36px; padding-left: 8px; } When I login to the site my browser gets redirected to /url/menu_tile.png. The only place I can find menu_tile.png in my site is in a css file that i...

Struts2 anchor tag doesn't include contextPath

%{#request.contextPath} doesn't work inside an s:a tag in Struts2. (Struts 2.2.1 to be specific.) Is there a way to make it work? It works in other Struts2 tags. Here are two lines in a JSP file in a Struts 2 project whose context path is "/websites": <s:a href="%{#request.contextPath}/clickme" theme="simple">Click here.</s:a> <s:form...

Struts 2.0 for RIA

Can we consider Struts 2.0 to create Rich Internet Applications? What are the criteria to evaluate for choosing technology for RIA? ...

How can I use freemarker variable inside JSP tag?

I would like to use variable calculated in freemarker inside Struts tag. How can I do this in following situation: <#assign val0=100 /> <#assign val1=1000 /> <@s.select value="amount" name="amount" label="Amount" id="amount" list=r"%{#{val0:'text100', val1:'text1000'}}"/> Currently this select is empty. ...

Struts2 - Access request object inside action's execute method

Is it possible to access the request object inside an struts2 action's execute() method? My requirement is to get some parameter value from the request scope which is being sent by some third party site, using URL redirection. ...

Can I use Calendar in a Struts2 Validator Annotation?

Is it possible to use the java.util.Calendar in a Struts2 IntRangeFieldValidator? The following code does not produce any OGNL errors but does not work either. I'm trying to create a validation rule for a year range, min= 1970 and max= current calendar year. @RequiredFieldValidator(message="Year cannot be blank") @IntRangeFieldValidato...

Struts2 Cron Jobs

Using struts2, is there a way to trigger an action to occur at specified intervals? Currently I am writing action classes that perform tasks that need to run at specified intervals and curling the url at the times I need to. Is there a better way to do this than invoking an http request like this? ...

What is the Struts 2 tag to create a table?

How do I create a table with fixed header and scrolling rows in struts 2? ...

Eclipse Syntax Highlighting Java Struts Hibernate Web App

Hi I am just getting started on Java, Struts, Hibernate, Tomcat - based Web App Development on Eclipse. I have installed Eclipse IDE for Java EE Developers on my Ubuntu system. Do I need to install any plugins for Syntax Highlighting to work properly - for Forms, Actions, Servlets, Classes, etc.? Thanks. ...

Java Struts Hibernate Web App on Eclipse

I am just getting started working on a Java Struts Hibernate based Web App on Eclipse. I have installed Eclipse (Helios) for Java EE developers for linux. While going through an Action Class SampleProjectAction.java, I find that that words ActionForward, ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse, Exception are...

Struts 2 dynamic parameter binding

The default stack has the parms interceptor who binds the parameters to the setters found in the action who is being invoked. That works fine when you know the name of the parameter. For example if a request parameter is "employee.name" that could be binded to a property of my action which has a property "employee" with a property "name"...

import org.appfuse.webapp.action.BaseAction cannot resolve

hi, i was following the guide http://appfuse.org/display/APF/Using+Struts+2 to make a simple appfuse site, but i got an error while compiling with Maven, which is reporting org.appfuse.webapp.action.BaseAction does not exist. I searched a lot from the google with no luck, can anyone give me a hints, appreciate for any help, idea or ad...

How to get the client IP address inside struts2 action method?

Is there a way to get the client's IP address inside an struts2 action method? I have implemented both SesionAware and RequestAware interfaces, but these two inject only the session and request maps. ...

How to use Java constantns as a parameter in a Struts 2 OGNL tag

Hi, I am ussing to recover a property from an object User in the session. The following expression works correctly: <s:property value="#session.ATRB_SESSION_USER.getAttribute('ATTRIBUTE_USER_NAME')"/> but those strings ATRB_SESSION_USER and ATTRIBUTE_USER_NAME are constatns defined in a class. How can I use the constant instead of th...

Select box validtion in struts 2

i have form conating a select tag foe example.... "" and in validation.xml i have the following code.... " hello " the slect box is getting validated on client......but the problem is when i submit the form one more validation of same form takes place on server which throws select box is empty.... can an...

select box validation struts2

i have form conating a select tag foe example.... "s:select headerKey="" headerValue="Select Gender" key="gender" list="#{'M':'Male','F':'Female'}" /" and in validation.xml i have the following code.... "field name="gender" field-validator type="requiredstring" message hello /message /field-validator /f...