struts2

passing in an array to a struts to action param from a select tag on a jsp page

In my action class I have an array of String (String[]) field with default getter and setters. Then I have a form that calls this action from a jsp page but I can't figure out how to pass the whole array into the action. I am using the and tags. Just passing the whole array into the tag doesn't work and when I use a loop and pass a si...

how to access properties in the test attribute of a struts if tag

I'm iterating over an array of beans called 'classifications'. How do I access the parentID property within the tag? I tried %{parentID} but that does not work. <s:iterator value="classifications" status="theStatus"> <s:if test="%{parentID} == -1"> <p>-1: <s:property value="subjectName" /></p> </s:if> <s:else> ...

How to send a XML doc to server from client in jQuery

I'm trying to send XML doc to server from client. But when server get a XML doc. It's always empty. Here is my jquery function. It's send XML to server: var str = '<?xml version="1.0" encoding="UTF-8"?><foo><bar>Hello World</bar></foo>'; var xmlData = strToXml(str); // convert string to xml console.log($.isXMLDoc(xmlData)); // r...

Struts2 getting request object as null

Hi, I am facing a strange error in Struts2, I am getting a null pointer exception when trying to set attribute into request scope, Struts Problem Report Struts has detected an unhandled exception: Messages: File: org/apache/catalina/connector/Request.java Line number: 1,424 Stacktraces java.lang.NullPointerException ...

Getting error while using display tag

I am using a display tag to display my table and it generating pagination on its own but when i click on the next page link i get HTTP Status 403 - Access to the requested resource has been denied I am using the display tab in combination with the struts tags could any one please tell me what might be going on..? Kaddy ...

Struts2 json ajax and also custom return type

I am trying to do a result type of "json" from my struts2 action. Here is the configuration I have in my code. Struts.xml: <package name="example" namespace="/" extends="json-default"> <action name="vendorList" class="com.stg.providerportal.actions.AjaxVendorListAction"> <result name="success" type="json"></result> </act...

Struts2 get the text boxes (dynamic) to action class

I have struts page where the text boxes are with dynamic ID and wanted to get this values into Action class. Can someone please help me with the code plz. ...

Using one struts 2 tag inside another

Hi All, I have a struts 2 select element to select the mumber of results to be diplayed per page. I set the selected value in a session variable. On the JSP page I want the user selected value to be preselected in the select element. If I hard cord the value it works like this <s:select name="fetchSize" cssClass="textCopmanyPropValue" ...

dynamic value to key attribute

Hi, Below is my code in jsp. <s:iterator value="msgList" status="stat" id="element"> <tr> <td><s:label key="msg" /></td> <td><s:property value="value" /></td> </tr> </s:iterator> msgList is a list which contain Message class. Message class is having 2 member variables msg and v...

struts2 data cut in string send to jsp

Hi, i've got this problem again... So i've got String data in my Struts2 app. this data is quite big, 36KB data read from html with code: BufferedReader reader = new BufferedReader(new FileReader("FILE.html")); String readData; while( (readData = reader.readLine()) != null) { fileData.append(new...

Spring validation with Struts 2

I am considering using Spring Validation for my application for reuse purposes. I created a validator that implements org.springframework.validation.Validator. Is it possible to configure this to work with Struts 2 validation? ...

how to setup reset to previous session object in struts2

In my application i load data from the DB to the web form and client can edit the fields and update the data. I use reset button, if user need to reset the form with original DB data after he edit some fields. However, once user edit some fields and submit the application, if there is any validation errors(I use validation xmls) user c...

How To Prepopulate Checkboxes With Struts2 and Jquery?

I am trying to determine the best/easiest way to prepopulate certain checkboxes created using Struts2 form tags. My application is a "normal" three tier setup, using Struts2 on the controller layer. Before I really, really dig deep here, does the tag support creating the list of all possible checkboxes, then populating it (say, via the...

JSTree Generating Links that are not usable in JSP page w/ Struts2

Hi, I have a tree generated with JSTree in my JSP page (part of a Struts2 webapp) as follows: <div class="panel"> <div id="demo1" class="demo"> <ul> <li id="node"><a href="#"><s:property value="product"/></a> <ul> <li id="node"> <a href="#">Dependents</a> <ul> <s:iterator value="dependentsList" id="dependent"> ...

First Struts2 application with AOP

Hi, i want to make an web app based on appfuse-basic-struts maven archetype. My goal is to add AOP with the simplest way, I never used AOP before, so could someone help me with this? Any tutorial - how to add and use it? Any good AOP solution ? (AspectJ/Spring AOP) Any advice on how to write it? ...

Struts2 debug tag thinks toString() is udefined

Debug tag in Struts2 keeps getting this error. Any ideas what could cause this? FreeMarker template error! Expression stackObject.value.get(propertyName).toString() is undefined on line 58, column 122 in template/simple/debug.ftl. The problematic instruction: ---------- ==&gt; ${stackObject.value.get(propertyName).toString()?html} [on ...

struts 2 validation don't work, why?

I implemented some actions in a Struts2+J2EE environment. I'd like to validate inputs with the struts validation framework: my package extends struts-default, my action extends Action Support and I put the xml file (MyActionClassName-validations.xml) in the same folder of my action. It doesn't work! Could I do something to check if valid...

Submit form (Ajax style) when a radio button is selected -- Struts2

In Struts2 I wanted to refresh(submit) a portion of page on selection of a radio button (Ajax) retaining all the rows in table of rows. Can someone please help with the code for this. ...

Struts2 setting object from jsp

I have queried DB and set that object in Action class and set that back to jsp to display results. Now I want the same object into another or same action class. How do I do that. ...

How to gzip ajax requests with Struts 2?

How to gzip an ajax response with Struts2? I tried to create a filter but it didn't work. At client-side I'm using jQuery and the ajax response I'm expecting is in json. This is the code I used on server: ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPOutputStream gz = new GZIPOutputStream(out); gz.write(json....