FAQ Database Discussion Community


struts 2 dispatcher and tomcat 6 security

java,tomcat,authentication,struts2
i'm trying to get struts2 to work with a tomcat 6 authentication application. my app works fine when the user is logged in. but i can't use struts tags to work in my jsp if the user isn t logged in or the user is denied (403) is there a...

Struts2 Form submission with asynchronous jQuery ajax not working

jquery,ajax,struts2
I am trying to make a simple asynchronous Struts2 form submission using jQuery ajax feature. However, whatever i try, the jquery is not getting triggered. Normal form submission is working smoothly but i need an asynchronous call which can fetch result from server without reloading page. I have already tried...

Struts tags-tiles cannot be resolved in either web.xml or the jar files

java,jsp,maven,struts2,tiles
I am using Struts2 in Eclipse IDE and JBoss5 server and maven for build. I was trying to use tiles in a simple login application. But I am not able to include the taglib. I have imported all the necessary jars dependencies in pom.xml file. Following is the list of...

Struts redirection

redirect,struts2
I have one abc.jsp page. I have an image on that page. On clicking that image, I need to check for user already logged in or not. If yes, I need to display xyz.jsp. If not, I need to ask the user to login. On success, again I need to...

Does the Struts2 tag escape HTML by default?

jsp,struts2,escaping,struts-tags,html-escape
Unless escapeHtml="false" is explicitly set, the <s:property> tag escapes HTML by default: <s:property value="someValue" /> <!-- the HTML contained in "someValue" will be escaped. --> Does <s:set> also behave this way ? <s:set var="myVariable" value="someValue" /> <!-- will the HTML contained in "someValue" be escaped ? --> ...

org.hibernate.exception.ConstraintViolationException: could not execute statement

java,hibernate,struts2
So this is the case.. I am creating a web application using struts2 and hibernate. I am creating a change password page by which a user can change his password. But I am getting error as "org.hibernate.exception.ConstraintViolationException: could not execute statement".. Below is my code and stack trace. //JSP <[email protected]..

How to pass parameters to an action by a post or ajax call in jQuery?

javascript,jquery,struts2
My intent is to pass a couple of parameters to an action in struts2, but I want that these parameters have to be hidden, so the GET call is not recommended. I thought that a post or ajax call in jQuery could be a good idea to do so, but...

How to perform XML Validation when using ModelDriven?

java,xml,validation,struts2,model-driven
I've created a Struts2 project in which I used XML based validation. Model class RegistrationForm is shown below package com.projects; import com.opensymphony.xwork2.ActionSupport; public class RegistrationForm implements Serializable{ private static final long serialVersionUID = 1L; private String fname; private String lname; private int numbr; public int getNumbr() { return numbr; }...

Struts2 json response using $.getJSON results undefined response

java,jquery,ajax,json,struts2
I'm trying to get a String value from action class using $.getJSON method, but I'm getting the result as undefined. Here are the code snippets which I have tried with Script: $(function() { $("#newPostionFormID").submit( function() { var formInput = $(this).serialize(); $.getJSON('../employeeShifts/addnewposition.action', formInput, function(jsonResponse) { console.log(jsonResponse.positionAdded); }); return false; }); });...

Return object and JSON object from Struts 2 Action

java,json,jsp,struts2
I search for this case but couldn't find a solution. I would like to return List or JSON Object (for this List) from the same action class based on user request. I am trying to configure based on my return name but not able to do it. Eg; if isJSON...

Action errors are not shown on the JSP

java,jsp,struts2,struts2-interceptors
I have tried adding action errors in the Action class and printing them on the JSP page. When an exception occurred, it is going into the catch block and it is printing "Error in inserting the Exception, Contact the Admin", in console. In the catch block, I've added it with...

Struts2 jqGrid Refresh Button Text

jquery,struts2,jqgrid
I have a Struts2 jqGrid on a page. I have the nav bar with the standard refresh button in the default location. My users want the mouse-over text of the button to be "Refresh" instead of the default "Reload Grid". I haven't not been able to find an attribute to...

How to check string inequality in s:if in Struts2

string,jsp,struts2
I am using <s:if> tag of Struts2 in one of the jsp-s. It is something like this: <s:if test="%{#request.STATUS.equals('SINGLE')}"> ... ... </s:if> It works fine. Now below this code, I want to write a code which will work only when status is not single. So I used <s:if test="!(%{#request.STATUS.equals('SINGLE')})"> ......

How to display HTML markup content from database record to browser properly in Struts 2?

html,struts2,escaping,html-escape
I have a simple text stored in the database record: Hello wrapped in an h1 tag. When I print this record in the JSP with the <s:property /> tag, it displays: <h1>Hello</h1> While I want it to be displayed like: Hello How can I get the interpreted value, instead of...

Struts2 autocompleter of struts jquery tag not taking another value other then of list after setting forceValidOption to false [duplicate]

java,jsp,autocomplete,struts2,struts2-jquery
This question already has an answer here: Struts 2 jquery autocompleter with forceValidOption=“false” 1 answer I have a jsp file in which i have a struts autocompleter box of struts jquery plugin. This box is not taking any other value which is not in the autocomplete list after setting...

Struts2 ignoring Action class value properties from applicationContext

java,struts2
I'm not sure why Struts is not setting a simple String property defined in the applicationContext.xml for an Action class. It is setting a reference but not a String value property. Is as if Struts ignores these properties because I tried something like this <property name="IDontExistInActionClass" value="MyValue" /> and Struts...

How to draw multiple HTML Tables from a single Collection with ?

java,html,collections,struts2,ognl
Assume I have two tables, Monday and Tuesday. I want to populate these tables according to a property of the object. Thus: <s:iterator value="trainings"> <table> <tr><th>Monday</th></tr> <s:if test="weekday.toString().equals('MONDAY')"> <tr> <td> <s:property value="title" /> </td> </tr> </s:if> </table> <table> <tr><th>Tuesday</th></tr> <s:if test="weekday.toString().equals('TUESDAY')"> <tr> <td>...

Changing request parameter value in Struts2 interceptor

java,struts2,request,liferay-6,interceptor
Does anybody know if it is possible to change/remove request parameter values in a Struts2 interceptor? The request parameter Map is an instance of UnmodifiableMap so it doesn't look like it can be manipulated with in the interceptor. UPDATE: I'm using Liferay so uParamsMap will be an UnmodifiableMap public String...

how to implement global redirect page in struts2

struts2,struts,struts-config
We're using Struts 2 in our web application. There are bunch of action mappings defined already, I want to implement a feature where any Urls starting with /buy and not mapped to any of the existing action mappings e.g. /buy/new or buy/old should be redirected to buy/index action. For example...

HTTP 404 error - in simple Struts2 application

java,eclipse,tomcat,struts2,http-status-code-404
A simple hello world application is showing http-404 error. I am using the tools below: 1) Eclipse Luna 4.4 2) Apcache tomcat 7.0 3) JDK 7 Application structure Am I missing any jar files ??? index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">...

Parent package is not defined : jfreechart-default [Unkown Location]

configuration,struts2,struts2-jfreechart-plugin
I am trying use Struts2 jfreechart plugin - using a Maven project. In Maven dependencies I am able to see the jfree-chart jar file. DO I need to use a separate package? Can any one help ? Getting following error: SEVERE: Dispatcher initialization failed Unable to load configuration. - [unknown...

session management across tabs in jsp

java,jsp,session,struts2,session-variables
Technology-- Struts2 & JSP Access URL--http://localhost:8080/session_acroos_tab/login.action In Welcome.jsp user is entering some value in 'First Text Field' and clicks on 'First button'. On clicking this button(First button),firstButtonClick function of LoginAction.java is called. Now control will again transfer to Welcome.jsp. On this jsp value entered by user in 'First Text Field'...

who's can help me with struts2 and hibernate to solve a particular exception: HTTP 404 - There is no Action mapped for namespace

java,hibernate,jsp,struts2
I'm learning how to use struts2 and hibernate, but i can´t resolve this exception "There is no Action mapped for namespace [/] and action name [registrar_barrios] associated with context path [/ConsultarPatente].". I know it's asked many time, but it's common for several case, as well here we go: The next...

Struts2: Unable to set multiple default selections for struts select tag

java-ee,struts2
<s:select name="carTypeIds" list="carTypes" listKey="carTypeId" id="selectTypes" key="carTypeId" size="4" listValue="name" headerKey="" headerValue="All" multiple="true" value="%{carTypeIds}" label="Car Types" /> Here carTypes is list of type Car containing properties carTypeId (long) and name (String). carTypeIds is a String array containing carTypeIds which I want to select by default. Why is it not working? when I...

Unable to load bean using Struts convention plugin

java,maven,tomcat,struts2,struts2-convention-plugin
I want to use annotation based config instead of xml based. Struts has convention plugin to do this kind of thing. So I removed struts.xml file in main/resources, added this plugin as dependency, put some annotations on actions and tried to run my project on a server (Tomcat 7). When...

Scope attribute migration from Struts1 to Struts2

java,struts2,migration,struts-1
I am migrating an application from Struts1 to Struts2. I could migrate everything except the scope attribute from the below action tag of the Struts1 configuration file (struts-config.xml). Struts1 configuration: <action path="/DomainAndIPBlocking" type="com.tarangtech.da.struts.action.DomainBlockedListAction" name="DomainBlockForm" scope="session" input="/DomainAndIPBlocking.do" validate="false"> <forward name="success" path="/jsp/SystemAdminConsol/DomainBlocking.jsp"/> </action> Migrated Struts2 configuration:...

Using to dynamically build element's name

jsp,struts2,iterator,ognl,struts-tags
I want to reuse a set of HTML field elements and have struts build 'name' attributes from a variable. I saw this How To Generate unique HTML id attributes within Struts 2 iterator tag and figured I could use something similar but can't get it to work. It seems I...

How do you populate a displaytag column title with a Struts2 properties file entry?

struts2,displaytag,properties-file
In Struts2 you can populate a label for a component with a value from a properties file. The properties file must have the same name as the Struts2 Action Class that will serve up the JSP and be in the same folder as that Action Class. <s:textfield key="field.label.casereference" name="caseReference" />...

iOS send a string like “2015-01-01” to server and get ParseException

java,ios,ajax,json,struts2
My question is not same as that question about get date from JSP. Now I have a server using Struts 2.2.1 And the action is like this public class AddMeetingAction extends ActionSupport{ private A a; @Override public String execute() throws Exception { .... } //getter and setter.. } And the...

Change Struts 2, i18n classes behavior when key is not found

struts2,internationalization,jsp-tags
We used getText in actions, setMessageKey in validators and <s:text> in jsp files for an i18n application. When Struts 2 could not find a key in resource bundles it returns the key itself. For example form.transfer.confirm . How can we change this behavior in the way that instead of the...

Getting the jsp source code appended with the file content when I download files

java,jsp,jboss,struts2,weblogic
I am working on a File upload/download functionality, in Java using Struts2 framework, where we are uploading to and downloading from a remote server path. All seems to work fine when I check the functionality at my local machine with a local path as the destined path from where i...

Struts2 + Log4j2

java,struts2,log4j2
I'm developing a Struts2 webapp and i was setting up the logger. In the official documentation there is only the configuration for log4j, but nothing about log4j2. I started looking around and seems that Struts2 does not support log4j2. But the last question i've found is this one: Log4j2.0 is...

Warning: Action does not match allowed action names pattern, cleaning it up

java,regex,struts2
I have below struts.xml: <action name="viewreports" class="com.mypackage.action.ViewReportsAction"> <interceptor-ref name="notauth" /> <interceptor-ref name="defaultStack" /> <result>/staff-view-reports.jsp</result> <result name="index" type="redirect">/index.jsp</result> </action> <action name="viewdepartment" class="com.mypackage.action.ViewDepartmentAction"> <interceptor-ref name="notauth" /> <interceptor-ref name="defaultStack" />...

Making elements non-editable in Struts using jQuery

jquery,struts2
I am using Struts and jQuery for one of my web applications. In one of the screens, some elements need to be disabled based on certain conditions. For ex, If a val of variable test is "Employee", then a drop down box (select box in struts) should be disabled. User...

Prevent login user to web application if already login Struts2

java,java-ee,struts2
How can I prevent a user to log in, if that user is already logged-in on a different system using Struts2 framework?

Struts2: Unable to fetch values from value stack

java-ee,struts2,valuestack
<s:property value="%{sourceName}"/> <input type="text" name="sourceName" size="40" maxlength="25000" id="sourceName" class="gray" value="%{sourceName}"/> <s:property> prints the string present in sourceName, but unable to set the value attribute for textfield to sourceName. Why is it that I am able to access value from value stack at some places and not at others?...

text change event sj:autocompleter struts2 jquery

struts2,autocomplete,jquery-autocomplete,struts2-jquery
Here is what I am trying to do. If the user makes a selection from the suggested options then I display a div tag using jquery. I use onCompleteTopics to fire this event. Now when the user makes any changes to the text box I want to hide the div...

Struts2 / jQuery: resume link href redirect after e.preventDefault();

jquery,jsp,struts2,preventdefault
On my Struts2 application, I have some buttons that will delete items from a table. So far, so good. Now, I'm trying to use jQuery to present the users with an alert to confirm if they really want to delete the chosen item. To do this, what I have in...

Auto-submit form with hidden value

jsp,struts2,form-submit,hidden-field
In my Struts2 application, I want to pass a hidden value from a JSP file to an Action class. This will be the sole purpose of this JSP page, so in fact it will act as a redirection page, with a hidden value in it. My code: <form action="editexperiment" method="post">...

The validate method resets the form field values in Struts2

java,jsp,struts2
I have a User bean that contains the user and the password and a validate method that verifies if the length of the user is greater than 0. When I submit the form all values disappear from the form if there is an error. I don't find a way to...

Struts.xml vs. struts.xml

struts2
I am new to Struts2 and I am working on a simple project that helps me to learn. I started with my Struts.xml file with the S capitalized. When I run it, I get my web page as expected with a couple fields and a submit button. When I fill...

Struts 2 get Json from DAO into the action class

java,jquery,sql,json,struts2
I have some unique probably understanding issue. I have jQuery Ajax call which call Struts2 action class which in turn calls DAO to get some data. However for some reason I do not get any data or any error, just a blank response when I add DAO operation in action...

org.apache.tiles.util.TilesIOException [closed]

java,spring,jsp,struts2
Hello I am working on struts project. I have deployed the project on linux tomcat server. After clicking on the page it is giving following error. But the same page is working very well in my local machine. HTTP Status 500 - ServletException including path '/Pages/Layout/baseLayout.jsp'. type Exception report message...

Struts2: Best practice and best location for .properties files

properties,struts2
Based from the information I've read, in order for you to expose your properties to the .jsp, you will have to set the properties file at the same level as your action method. Currently, this is how my sample app directory looks like: app | | build | src |...

Struts exclude pattern with spring

java,spring,spring-mvc,servlets,struts2
I did a lot of homework before coming here to the experts , appreciate any pointers on my question I need to run a merged (not integrated) app that was basically combined version of struts2 and Spring and some base servlets. Was able to get the combined war file up...

Using s:url in s:a in struts2

jsp,struts2
I'm trying to generate a link for each string in my List of strings. This link will call an action and pass in a parameter (a getStudentById action passing in the studentId). I've tried a couple of ways to get this to work by searching on the interwebs, however, have...

Hiding param of struts.xml values in Struts 2

java,url,struts2,passwords,url-parameters
Is there any way to hide the param values in struts.xml as they are visible on the URL when I pass them from one action to another? <action name="BackToManagerIndex" class="Action.LoginAction" method="ManagerList"> <result type="redirectAction"> <param name="actionName">login</param> <param name="namespace">../Manager</param> <param name="User_Id">%{User_Id} </param> <param name="Password">%{Password}</param> </result> Here when ever the BackToManagerIndex action is...

How to call MySQL view in Struts2 or Hibernate

java,mysql,hibernate,java-ee,struts2
I have a view in MySQL database CREATE VIEW CustInfo AS SELECT a.custName, a.custMobile, b.profession, b.companyName, b.annualIncome FROM customer a INNER JOIN cust_proffessional_info b ON a.cust_id=b.cust_id Is there any way that i can call this view using Struts2 or in Hibernate. I have tried to search it but could not...

Java Struts2 (Action class not found)

java,xml,jsp,struts2
The error which I am getting. It was running all fine a day before but when open it today I get the following errors. Action class [com.tutorialspoint.struts2.HelloWorldAction] not found - action - file:/C:/Users/sai/Struts2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldStruts2/WEB-INF/classes/struts.xml:10:30 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374) at...

Wildcard mapping on Struts2

jsp,struts2,wildcard-mapping
I followed an online tutorial on how to use Wildcard technique in Struts2 but it does not work as shown. On execution of the command, it only calls the execute() method and never calls any other methods. I'm not sure what the issue is, but any help would be amazing....

Onchange in Struts2 textfield

java,javascript,jquery,jsp,struts2
I want to get all records from DB to JSP based on a string what I enters in S2 textfiled. While typing in textfiled only I want to get those all records as a table in JSP. Ex: In textfiled, while I typing 'a' then I want to display all...

Struts startup failed due to logging errors

struts2,log4j,classloader,slf4j,nosuchmethoderror
Struts application can not start with log4j. What is wrong? Here is log4j.properties # Direct to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n # Root logger option log4j.rootLogger=INFO, stdout # Good for troubleshooting log4j.logger.org.hibernate=INFO # Log JDBC parameters log4j.logger.org.hibernate.type=ALL Struts startup failed due to logging...

Set default value for struts 2 autocompleter

jquery,jsp,struts2,struts2-jquery,struts2-jquery-plugin
I have implemented a struts 2 autocompleter in which i have used a list of String like this - <sj:autocompleter id="cityId" cssClass="txtfield8" name="outlet.cityName" list="cityList" autoComplete="true" forceValidOption="false" /> How can I set a default value for this, so that every time it loads, a default value will be shown ?...

Struts 2 could not find a result for success returned from an action

java,osx,jsp,netbeans,struts2
I'm not a native English speaker, so my apologizes if I made some idiomatic mistake. I'm completely new on Struts2. I developed a web project that contains 3 JSP pages, a deployment descriptor (web.xml), a struts configuration file (struts.xml) with 2 actions configured inside (an action named index and an...

How to get an Integer value from String

java,jsp,struts2,struts-tags
Here is my DAO: public ReportType getByName(String type) { EntityManager em = emf.createEntityManager(); try { ReportType rptype2 = em.find(ReportType.class, type); return rptype2; } catch (Exception e) { e.printStackTrace(); em.close(); } return null; } Here is my Action: ReportDAO dao = new ReportDAO(); List<ReportType> reportType = dao.show(); list = new ArrayList<>();...

For loop issue in Struts 2

java,jsp,struts2,ognl
I found below code in JSP at somewhere. <% int cnt =1; for(int i=1;i<=iTotalweeks;i++) { %> <tr> <% for(int j=1;j<=7;j++) { if(cnt<weekStartDay || (cnt-weekStartDay+1)>days) { %> <td align="center" height="35">&nbsp;</td> <% } else { %> <td align="center" height="35" id="day_<%=(cnt-weekStartDay+1)%>"><span><%=(cnt-weekStartDay+1)%></span></td> <% } cnt++; } %> </tr> <% } %> Now I'm doing...

How to retrieve an instance from the database and display it using struts2 and hibernate?

java,hibernate,jsp,struts2
I want to display an instance of the company pojo from the database. All I am able to display is the CompanyId the rest of the details are not getting displayed. viewCompany.jsp `<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...

Node.js with struts Possible? [closed]

java,javascript,node.js,struts2
Now i know i might come out to be very silly at asking this. But I am a complete newbie to node.js and i have done some reading about node.js, and so much unstructured info on the internet has only confused me further. I have a small web application with...

Use property variables for the next action which is call by form

hibernate,java-ee,web-applications,struts2,action
I have one jsp web page which is the result of an iterator struts. In other words I have a list which is the result of an easy hibernate query select from TABLE. Iterator struts2: <s:iterator value="usersList"> <s:property value="userName"/> </s:iterator> At the same time my jsp page has one form...

How to send the selected value in a autocompleter as a parameter in a URL?

java,jquery,url,autocomplete,struts2
I'm working with Struts 2 and jQuery plugin . I have a JSP with a sj:autocompleter which need to submit its value as a parameter in a sj:a. <s:url id="loadClientURL" action="loadClient"/> <sj:autocompleter id="client" name="client" list="listClient" href="%{loadClientURL}" formIds="guardarVBForm" loadMinimumCount="2" size="70" /> <s:url id="myActionURL" action="myAction"> <s:param name="client" value="%{client}"/> </s:url> <sj:a href="%{myActionURL}" cssClass="btn"...

Struts namespaces and WEB-INF folder

java,jsp,tomcat,struts2
I want to put view.jsp file in WEB-INF folder. it lies in WEB-INF\user\view.jsp <package name="user" extends="struts-default" namespace="user"> <action name="view" class="com.example.user.ViewUserAction"> <result>/WEB-INF/user/view.jsp</result> </action> </package> but Struts changes this url to application/user/WEB-INF/user/view.jsp so as I understand if my namespace is not "/ " I will never visit the jsp in WEB-INF ?...

How do I initialize in struts2 using JavaScript?

struts2,struts2-jquery,struts2-jquery-plugin
I am developing a struts2 application and have been using <sj:accordion> (https://code.google.com/p/struts2-jquery/wiki/AccordionTag). Until now, I have been initializing it on my jsp page by hardcoding the value I want in the tags but is there anyway to initialize it using JavaScript? Here is what I'm trying to solve. I have...

Struts 2 Tag System,Insert in database,texfield seperate values in struts2

jquery,hibernate,struts2
I am implementing Tag System with Struts.I have two tables in database,Blog and Tag using Hibernate with many to many relationship.I have integreated JQuery tagEditor(http://goodies.pixabay.com/jquery/tag-editor/demo.html). When I insert a single value it's ok,but when i insert more than one values(Tags),it is inserting like a single value in database. I haven't...

Struts2 Ajax validation won't work

javascript,jquery,ajax,struts2,dojo
I decided to use Struts 2 DOJO plugin for the ajax validation of my forms. I have: Added Struts2 dojo and json plugin to project Added 'jsonValidationWorkflowStack' intercepter to my actions Included dojo taglib and <sx:head /> tag on my page Included <sx:submit validate="true" /> in my form Now, after...

What is the use of token tag in Struts2 and how does it work?

jsp,struts2,token
I came across this <s:token /> tag and it is enclosed in a <s:form></s:form> tag in a JSP Page. Some other StackOverflow link discusses its usage in maintaining session and prevention of double submission of forms. What exactly is the use of this tag? If it prevents double submission of...

struts dialog box not taking jsp scriplet

java,jquery,jsp,struts2,ognl
I am using struts dialog box in a jsp page. I want that id of each dialog box should be dynamic. For that I am doing this code - <% int counter = 0; %> <s:iterator var="RP" value="campaignList" status="currRow"> <% counter++; %> <sj:dialog id="DivQuestionAnswer<%=counter%>" autoOpen="false" modal="true" width="750" cssStyle="font-size: 15px;" title="Question...

What is equivalent Struts 1.3 tags for

java,html,struts2,struts,struts-1
I want equivalent Struts 1.3 tag for <s:property value="Content" escapeHtml="false" /> Currently I am trying something like <bean:write name="MyForm" property="Content" filter="false" ></bean:write> I want to hide/remove HTML tags from My Content - I am having data from CKEditor which is combination of HTML tags....

Retrieve first element of a collection via Struts property tag

java,jsp,collections,struts2
Let's say I have a collections called imagesNames. In my JSP file, I want to display the first element of this collections using Struts property tag. This is what I have tried, but obviously this won't work. <s:property value='imagesNames[0]' /> ...

Struts2 - passing data from jsp form fields with same name to action class

jsp,struts2,struts-action
In my struts form I have couple of fields (textfields) with the same name. They all carry the same information (through js change event). However, in the action class, they are imported as comma separated values instead of the value once. Here is a snippet from item.jsp: <s:select label="Part of...

How to refer to another package action in struts.xml?

java,struts2
I'm using Struts 2 framework and I've been playing around with such referencing, but cannot find the proper one. For example I have following packages struts.xml file: <package name="home" namespace="/" extends="struts-default"> <action name="index"> <result>/index.jsp</result> </action> </package> <package name="client" namespace="/client" extends="struts-default"> <action name="register" class="magazine.action.client.RegisterClientAction" method="execute"> <result name="success"...

Struts2 iterator how to get it to work?

java,html,jsp,struts2
I am using Struts2 iterator tag to display value in JSP. Method is getting called, but no results were displayed. It prints in console all the data that I need but not in JSP. I call localhost\listAddCompany.php What did I do wrong? Here's the method listAllCompanys(): private List<Company> listAllCompanys; Getters...

eclipse not validating the struts.xml file

java,xml,eclipse,struts2
I installed the eclipse in my new p.c. and import my old project of struts2 in that and after importing the project i got a warning in struts.xml file i.e. "The file cannot be validated as there was a connection problem.". I replaced my jar files and doctype so many...

How to call different method from execute in struts?

java,struts2
In my Struts app, I have an action, called Foo. <action name="Foo" class="some.path.here.foo"> <result name="SUCCESS" type="tiles">/foo.tiles</result> </action> Normally it calls execute(), but I want to call another method called change(). How can I do so? My Idea was this: <form name="Foo" action="Foo" > <s:textfield name="Mail" placeholder="Mail" /> <select name="someselect"> <s:iterator...

Using custom JSTL tags in a Struts tag attribute

jsp,struts2,jstl,ognl
I have a custom JSTL tag say foo which writes a said property to the writer. Now I want to use the value that the tag wrote in a Struts tag. As an example, the custom tag is invoked as <foo:property name="bar"/> The struts tag here is say <s:form/>. I...

What will be equivalent Struts2 code for the following select tag code in Struts1

struts2,struts,struts-1,struts-tags
I am new to Struts. I have to migrate code form Struts1 to Struts2 but confused in select tag of Struts2. Please help in writing the equivalent code in Struts2. <nested:select property="pmt_type0" onchange="openTable(this,0)"> <html:option value=""></html:option> <html:optionsCollection name="paymentTypesList" label="paymentTypeDescription" value="paymentTypeCode"/> </nested:select> ...

Complex headers via Display Tag in struts2

struts2
I have to create a table using display:table tag, whose structure is like this <display:table name="ReportList" cellpadding="0" cellspacing="0" > <display:column property="claimType" title="Claim Type" sortable="true" /> <display:column property="claimno" title="Claim Number" sortable="true" /> <display:column property="billStatus" title="Bill Status" sortable="true" /> <display:column property="transNo" title="Transaction Number" sortable="true"/> </display:table> Now It is Display like this...

Struts 2 add exception mapping for certain actions

java,exception,struts2,struts-config
Consider a project with lots of annotated actions. public class TransferMoney(){ @Action("transfer-money-show-form") public String showForm(); @Action("transfer-money-confirm") public String confirmForm(); @Action("transfer-money-result") public String result(); } I want to add exception-mapping to confirmForm so I can do it as: @Action(value = "transfer-money-confirm", exceptionMappings = [email protected]( exception = "java.lang.Exception", result = "exception") }...

How to update div text content dynamically from Apache Tomcat server using Struts2

javascript,jquery,html5,jsp,struts2
I'm developing an application where user uploads a file to the server and server process the text file. While processing, I need to update the user with some text sent from the server. Is there any way through which I can update text content of a div dynamically without reloading...

How to hide the “action” extension

struts2,struts-config
When user makes login then on success browser redirect to http://appname.com/main.action How can I make so that adress line will looks like http://appname.com/main <action name="login" class="user.action.LoginAction" method="execute"> <result name="success" type="redirectAction"> main </result> <result name="error">/login.jsp</result> </action> ...

How to ignore the root JSON node in struts2 action

java,json,struts2,struts2-json-plugin,struts-action
I added this method in my struts action, public String execute() { long start = System.currentTimeMillis(); simDetails = new SIMDetails(); return GET_SIM_DETAILS; } and added below action in struts config file, <result type="json" name="getSIMDetails"> <param name="noCache">true</param> <param name="includeProperties">simDetails.*</param> </result> Then i got below JSON response { "simDetails": { "void": null,...

Jquery onchange event not triggering

javascript,jquery,html,struts2,jquery-selectors
I am stuck in a situation where I have a Struts2 form with a select tag which when changed should trigger an event and I can't figure out why the onchange function is not triggering but the peculiar thing is that the onchange trigger event works in an other example....

Struts JSON plugin always sets null value

java,jsp,servlets,struts2
The getter menthods are successfully called. But the client side always receives null values. struts2 version 2.3.15 Struts2 JSON plugin version 2.3.15 Action Class public class UpdateInfo implements Action{ private String uname; private String uemail; private String uphone; private JSONObject status; @Override public String execute() throws Exception { DbConnector connector...

How to combine JSP fragments into seamless table regardless of ordering

html,css,jsp,struts2
I have multiple JSPs that each contain one or more tables. fragment1.jsp: <table class="foo"> <tr> <td>stuff</td> <td>stuff2</td> </tr> </table> fragment2.jsp <table class="foo"> <tr> <td>more stuff</td> <td>more stuff2</td> </tr> </table> <table class="bar"> <tr> <td>whatever</td> </tr> </table> They are used by wrappers in different configurations: wrapper1.jsp <s:include value="fragment1.jsp" />...

IE Error TypeError: Unable to get value of the property 'set': object is null or undefined

javascript,jquery,web,struts2,dojo
I am getting the following error when i run my web application in IE9. The application is using Struts and DOJO UI. Development console is showing: TypeError: Unable to get value of the property 'set': object is null or undefined This error does not occur in FF or other browsers....

Not able to get Request-scoped attribute in Action through XMLHttpRequest

jquery,ajax,struts2,http-headers,xmlhttprequest
I am setting receiverid in jsp page. I am sending textarea value in action using ajax and on same method I am getting client Ip that is working properly. I also want to get receiverid which is set in jsp page. But this is showing NullPointerException. In jsp <s:set var="receiverid"...

Update a particular record in a table using struts2 and javascript

java,javascript,struts2,jqgrid,displaytag
How can I make the particular record editable and after changing the fields update to that particular record. I have never used JavaScript so I am facing a lot of perplexion between the javascript, struts 2 and hibernate. Following are the required material to help me out. I want to:...

How to avoid Default value ([email protected]) for textfield in struts2

jsp,struts2,jstl,ognl
I am working on a struts2 application. In one of the JSP page I have a textfield tag for which value is retrieved from OGNL expression. When the OGNL expression value is empty it is showing [email protected] in the text field. I do not want this default value, if the...

Json serialization issue when using Struts2-Json plugin

json,serialization,struts2,struts2-json-plugin
I have an action class with 3 properties. I am using Struts2-Json plugin to serialize the action class. I am able to serialize the String selectedCompany as per my expectations The problem The People ArrayList<Person> property is serialized with empty values. I don't seem to find where I have made...

Struts 2: No configuration found for the specified action

java,jsp,struts2
I'm trying to learn how to operate with links using namespaces, actions and struts tags. I have a simple login form in index.jsp page: <s:form action="login" method="POST" namespace="/welcome"> <s:textfield name="email" label="e-mail" type="email"></s:textfield> <s:password name="password" label="Password" type="password"></s:password> <s:submit value="Log-in"></s:submit> </s:form> <s:url var="url" namespace="/client" action="register"></s:url> <p> <s:a label="Register"...

Where exactly are new variables located when using Struts 2 tags?

java-ee,struts2
I'm learning to use Struts 2 tags and I have some doubts about where are new variables stored when using some of those tags. For example, when I want to create a new variable in the action scope like this: <s:set var="newVar" value="'This is a new string'" /> and then...

The validation and theme in Struts 2

java,css,validation,jsp,struts2
I am working on a Struts 2 project ,the problem is that I am using <constant name="struts.ui.theme" value="simple"/> in my struts.xml for the layout of my JSP page(e.g arranging 2-3 textfiled in one line using tablecode ) as per the CSS applied, but I am not able show the validation...

The file download folder view in Struts

file,jsp,struts2,struts
I'm creating a project of a school. I want to show the uploaded stuff by teachers to students. But I also need to save the file in the folder which is named as faculty name. Student will be able to browse the main directory and after that he can go...

Struts2 jqGrid DatePicker in Column Filter

jquery,jsp,struts2,jqgrid,datepicker
I have a jsp running Struts2 jqGrid plugin. I have enabled the filter row at the top of the grid, one of the columns is a date column and I want to be able to change the textbox at the top of the column into a DatePicker. The id of...

Change default location of struts.xml in Struts2

java,xml,struts2,web.xml,servlet-filters
I've created a Struts2 project which is working fine when I place my struts.xml file inside src directory. Below is my web.xml configuration. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>struts2project</display-name> <filter>...

How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

spring,spring-mvc,struts2,struts2-convention-plugin
I am trying to configure spring plugin with strut 2 application which is already running with convention plugin, so I am using annotations. I am using ExtJs for my form submission which was initially working well until I introduced the spring plugin, now the the ajax request cannot locate the...

Can Struts 2.3 be used with Struts 1.3?

struts2,struts,struts-1
we have 2 applications (Say AppA and AppB) that use Struts 1.3. I want to upgrade AppB to use struts 2.3, however I cannot make changes to AppA so it will have to remain in Struts 1.3. The problem is that AppB has some dependencies on AppA such as extending...

Restriction on number of opened tabs

javascript,jsp,web,struts2,browser-tab
There are some links on web-page. On right click there is option of 'open link in new tab'(browser option). I want to restrict user for not opening more that two tabs? How can i do this? <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">...

Struts2 sj:head with scriptPath

struts2,struts2-jquery
I have a web application made with Struts2 . I'm using struts2-Jquery plugin. With this setting in the jsp head section: <%@ taglib prefix="sj" uri="/struts-jquery-tags" %> <head> <sj:head/> </head> Everything is fine, the generated HTML code looks like this: <script src="/MyContextRoot/struts/js/base/jquery-1.10.0.min.js" type="text/javascript"> Regarding to the API: https://code.google.com/p/struts2-jquery/wiki/HeadTag If I change...

Struts 2 autocompleter not working as dropdown

java,jsp,struts2,struts,struts2-jquery
I have a JSP page in which I have use sx:autocompleter. It is working but at the time of typing in textbox, suggestions are not coming in dropdown, they are coming as completing the word. Like this What is the problem here ? ...

Properties not being set in prepare method [closed]

java,struts2,struts-action,struts2-interceptors,interceptorstack
I am using Struts2 and an action implementing the Preparable interface. When I submit the form, action properties are not being set in prepare() method of action. I get the values in the action method (eg. execute()), but they are empty in the prepare() method. How can I get the...