struts2

Struts 2: return to calling page

Hi there. I'm using Struts 2. I'd like to return from an Action to the page which invoked it. Say I'm in page x.jsp, I invoke Visual action to change CSS preferences in the session; I want to return to x.jsp rather than to a fixed page (i.e. home.jsp) Here's the relevant struts.xml fragment: <action name="Visual" class="it.___.w...

Stuts2 Tiles Tomcat suspected of changing UTF-8 to ?????

I'm having some internationalisation woes: My UTF-8 string fields are being rendered in the browser as ???? after being returned from the database. After retrieval from the database using Hibernate, the String fields are presented correctly on inspection using the eclipse debugger. However Struts2/Tiles is rendering these strings as ?...

struts2: how to substring in jsp?

hi, is there a way to substring in JSP files, using struts2 technologies? I mean, struts2 has its own taglib and also uses ognl. How can I get a substring from a stacked value or bean value? thanks in advance. stv ...

Suppress ClientAbortException in struts2 VelocityResult class

I am getting the following stack trace in my log file and was wanting to suppress just this error from displaying in the log: ERROR 08-09-26 14:48:45.141 http-80-215 org.apache.struts2.dispatcher.VelocityResult: Unable to render Velocity Template, '/jsondata.vm' ClientAbortException: java.net.SocketException: Broken pipe ...

Struts2 Annotation-Validators for Invalid Chars

Heyall, While using Struts2, I am using several annotations to do my validations inside the Model class, in the set() methods, like: @RequiredStringValidator(message = "Name is required") @StringLengthFieldValidator(message = "Name must be between 5 and 60 characters", minLength = "5", maxLength = "60") p...

How can I serve an image to the browser using Struts 2 + Hibernate 3?

I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have an entity, User, which I have mapped to a table USERS in the DB using Hibernate. I want to have an image associated with this entity, which I plan to store as a BLOB in the DB. I also want to display the image on a webpage along with other attributes of t...

Struts2 - How to do dynamic URL redirects?

I'm trying to have my struts2 app redirect to a generated url. In this case, I want the url to use the current date, or a date I looked up in a database. So /section/document becomes /section/document/2008-10-06 What's the best way to do this? ...

How do I reference assets from a different subdomain (or CDN) in production?

I am working both in the Ruby and Java worlds. I have been inspired somewhat by the merb-assets project, which provides various functionality to make it easy to reference assets (images, CSS, etc.) located on a subdomain (or CDN). I want to do the same in Java: in development and testing, I want to use either JSTL's <c:url> or Struts ...

Struts2 Validation at the action vs domain object level

The struts2 validation framework allows you to define your validation for an action or at the domain object level. My question is, is there an advantage or disadvantage using one over the other? What do you recommend? My own findings: You may use the same domain objects in several actions and may have to re-define validation rules per ...

JSON RPC: java method never called, any ideas?

Hi all, I'm trying to get some code working that a previous developer has written. Yep, his now left the company. :-( I have a JSON RPC call being made from the JS code. The JS all runs fine & the callback method gets an object back (not an error object). But the method on the Java class never gets hit. The smd method does get hit tho...

Creating friendly urls to dynamic resources in struts2

I have a struts2 application with a single page that may show one of a number of values stored in a database. The application is for a school with many departments and each department has many programs. The department page is accessed using a url like this department.action?id=2 and the DepartmentAction will load the Department with i...

Using Stream Result with Struts2

I am attempting to use a Stream Result to return an image from a struts2 application. I seem to be having problem with configuring the action. Here is the configuration: <result name="success" type="stream"> <param name="contentType">image/jpeg</param> <param name="inputName">inputStream</param> <...

Reading an email string from a cookie in java

Hello all, My application needs to store the users email address in a cookie so that I can pre-populate a login form (username == email address). I set the cookie value in JavaScript. If I read it from JavaScript, I get "[email protected]". If I look at it in the cookie viewer in Firefox I get "[email protected]". When I try to read it on the serv...

Passing Parameter to struts2 component

I am attempting to create a struts2 component using freemarker. I created a ftl file with code like this: <script type="text/javascript" src="${parameters.library?default('')}"></script> Which is expecting a parameter named library to be passed to the component. If the parameter is absent then it defaults to a blank string. On my JSP...

Struts 2 + tiles + velocity interoperability?

Has anyone been able to get velocity + tiles working with struts 2? I am having some problem finding examples or tutorials online and from what I have gathered from mailing lists it seems it might not even be possible at all (but the mails were quite old). ...

Can Anyone Explain This Struts 2 AJAX Strange Refresh Behaviour?

We have the following code (listed below) in our JSP. We are seeing the action configured in the href of the div id=pwcercontainer being called twice. Can't work out exactly why. Replacing the containing sx:div label="Admin Record Deployment" with a plain non-struts div causes the action to be called only once. We can't see anything in t...

Struts 2 & Dojo files are too heavy and affect site's performance.. Any remedies?

Well.. we've developed a j2ee application using struts2 ajax capabilities. We find that the dojo implementation is quite slow. We did the following things: 1. Custom build of the dojo library. (increased dojo.js from 240kb to 350kb) 2. Took all the static stuff out of the struts jar and kept it outside. The performance was significantly...

Not getting the 'index" value from for loop to the if loop in the JSP

Hello. My if statement is always evaluating to false and not entering the <span> block. Because of which, I'm not able to get the value of "index" in the if condition, I've tried every thing appending index with # and %. Can anybody suggest the solution? <c:forEach var="index" begin="1" end="<%=a%>" step="1"> <s:if test="index == 1"...

disabling the Validation in struts2 and use my own customized validation

I'm developing web project in struts2 and I want validation in my own customized validation by disabling the struts2 validation, because if one field is being sent back it will check all fields but I want to check only at the time of submit. ...

How can I translate the validation messages of Struts 2?

I want to learn how to use Struts 2 and I created a simple application following a tutorial I found. I've created a <MyActionClass>-validation.xml file and I wonder how can I translate the validation messages to multiple languages? <field name="password"> <field-validator type="requiredstring"> <param name="trim">true</param> <...