Questions tagged [struts2]
Apache Struts 2 is an extensible framework based on servlets and implements model–view–controller (MVC) pattern in its architecture for creating enterprise-ready Java web applications.
11,351
questions
-1
votes
2
answers
34
views
Struts 2 - Multi Select with Thousands of Options
I have the following multi select block in JSP
inside a <s:form> tag. When I submit the form
the action method works ok.
<s:select
id="prodSelect"
list="#application....
1
vote
1
answer
43
views
Why the NullPointerException is coming in index.jsp file the <s:a> tag is not working
HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing [/index.jsp] at line [31]
Description The server encountered an unexpected condition that ...
0
votes
0
answers
23
views
How to send data from a list loaded by <s:iterator> [duplicate]
I was wondering that how could I get one of my data from a list loaded by <s:iterator>. iπ can see all of them on the website but I want to modify one of them. Below is my JSP page code. I want ...
1
vote
1
answer
41
views
How to redirect to a different namespace using Result annotation in an action class in Struts 2
I have a website that has public and protected areas. It is setup using Struts 2 (2.5.30) and the Convention Plugin (2.5.30).
In one of my actions, I am trying to redirect from the public (/pub/...
1
vote
1
answer
83
views
Struts 2 and JDK 17 numbers in locale
With struts 6.3.0.1 and jdk 8 the below generates 1, 2, 3,
<s:iterator begin="1" end="3">
<s:property value="top"/>,
</s:iterator&...
0
votes
0
answers
14
views
How to use org.apache.struts.config.SecureActionConfig in struts2 [duplicate]
We are migrating project from Struts1 to Struts2 but unable to find org.apache.struts.config.SecureActionConfig class in struts2 jar file, however it is working fine in struts1 project.
Can anyone ...
0
votes
1
answer
61
views
"org.apache.tiles.request.render.CannotRenderException: Cannot render an attribute that is not a string, toString returns: null" in Struts 2 app [duplicate]
I am working on a Struts 2 application that is integrated with the Tiles plugin. It works fine on my local computer. But when I deploy it to a UNIX server and try to navigate past the login page to an ...
0
votes
0
answers
34
views
Setting request_locale change format variable Date in Struts 2 [duplicate]
I have a web app with Struts 2.5.30 and struts2-jquery-plugin 4.0.3 , I'm using datepicker with displayFormat="dd/mm/yy" and when user change language with a click on flag image the param ...
1
vote
1
answer
71
views
In Apache Struts, how can I redirect to an external URL without writing an Action class?
In my Struts application, I need to create an endpoint (URL) which simply tells the user's browser to redirect to an external URL.
It looks like this can be done by creating a new Action class and ...
0
votes
1
answer
50
views
How to provide protection against Cross Site Request Forgery (CSRF) attacks for an old web application built on Java and struts2 framework [duplicate]
How to provide protection against Cross Site Request Forgery (CSRF) attacks for an old web application built on Java and struts2 framework?
Tried adding filter before servlet, stuck over there.
-1
votes
1
answer
52
views
How can I get Request Type(GET or POST) from list of Action names in Struts 2? [duplicate]
I want to get all POST/GET request types for all of the struts actions present in my application.
I have used struts2-config-browser-plugin and got all action names throughout the application.
Now, I ...
0
votes
1
answer
135
views
CSRF implementation error in struts 6.2.0
I am trying to implement CSRF in a Struts 6.2.0 project.
struts.xml
<package name="struts-security" abstract="true" extends="struts-default">
<interceptors>...
0
votes
2
answers
307
views
Is Struts-core-6.X.X compatible with Jakartaee 10?
I am migrating my struts-application from Javaee 8 to Jakartaee 10, Payara 5 to Payara 6(use community version) and Jdk8 to JDK 11.
Currently, I am using struts-core-2.5.26. Is latest version of ...
0
votes
1
answer
53
views
How to set session timeout in Struts2?
How to set session timeout in Struts 2:
import java.util.Map;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
public class ...
0
votes
0
answers
29
views
Struts2 extending multiple packages doesn't work [duplicate]
I have 2 packages - one for interceptor and other for actions. I am extending the interceptor package in my actions package. After running the app, the intercept method of the interceptor is not ...
1
vote
1
answer
34
views
UrlDecodeException - Ajax - Struts2
I need to take the information (year) from the HTML and based on that, retrieve the information from the database.
When I select the year from select, everything works, when the year is text an ...
0
votes
1
answer
57
views
How to customize message resources to xml files instead of properties in Struts 2
I have already xml messages which used for localization.
<messages>
<message key="greeting">Hello!</entry>
<message key="farewell">Goodbye!</entry>...
-1
votes
1
answer
62
views
Struts 2 locale seems to default to 'en', how to change? [duplicate]
Edit to clarify:
If my Struts 2 site is designed to support two languages, and a user comes to the site with a third (unsupported) language, how does the site determine which localisation to use?
If ...
1
vote
1
answer
56
views
Struts2 configuration conflict in Eclipse using Maven
I'm upgrading some old legacy applications to Maven. These applications run in WebSphere Application Server traditional 8.5.5 and I'm using Eclipse 4.16.0 to run the WAS server.
It compiles just fine, ...
1
vote
0
answers
27
views
Upgrading struts 1 to 2 and Java 17 [duplicate]
I'm trying to migrate an ancient struts 1 application to struts 2 and upgrade to Java 17. I think I've found all the code changes I need to make, but when I deploy I get a stack trace that starts out:
...
-1
votes
1
answer
62
views
What is the best way to create nested POJO classes for a dynamic JSON key in a Nested JSON?
I am calling the rest service with a body as JSON. It is necessary to create a POJO class in Java, but I am unsure of how to do so for a dynamic JOSN key within a nested JSON object.
The keys are ...
0
votes
0
answers
200
views
not able to use HttpServletResponse [duplicate]
i'm using struts 2(version 2.3.30), jdk 8, tomcat 10, (jakarta).
Getting the errors while using
HttpServletResponse response = ServletActionContext.getResponse();
eventually, this is using import org....
0
votes
1
answer
35
views
How to highlight and select first item in Struts2 Autocompleter using struts2-jquery?
I have the below combo box in my application and I use struts2 and dojo to show the autocomplete. If you notice it shows the typed text as highlighted in the results. If we click outside the typed ...
0
votes
0
answers
29
views
How to integrate JSON response - pageable with jquery DataTable [duplicate]
I am working with an API which provides the total data from database in JSON response. Along with data I am also getting few fields which are used for pagination.
{
"data": [{----},{----},{...
1
vote
1
answer
39
views
Struts 2 setting dispatcher:FORWARD makes struts.actionMapping to noActionMapping
To get the struts.actionMapping in jsp or tags we use struts.actionMapping of request
as an example this :
<s:property value="#request['struts.actionMapping']"/>
Shows some thing ...
1
vote
1
answer
42
views
UrlRewrite is not working in Struts 2 and the actions are not found
In Struts 6.2 I am using urlrewrite 4.0.3 with below config. ( explained at How to map a friendly URL to the action in Struts 2 answer)
<urlrewrite>
<rule match-type="regex">
...
-1
votes
1
answer
92
views
Spring-Boot based
How can Spring Boot be integrated with other Java frameworks such as Play or Struts?
I am working on a Java web application using Spring Boot and I would like to know how I can integrate it with other ...
1
vote
2
answers
435
views
How to map a path parameters in URL to the action in Struts 2
We are using Struts 6.2 on Tomcat 9, and map all .action extensions to actions, for example save-user.action maps to an action correctly.
The web application needs to handle this path parameters ( ...
0
votes
1
answer
82
views
<sx:submit> Button works in IE, but does nothing in Chrome
The problem is that the "Submit" button on a form, generated using the <sx:submit> tag, appears to do absolutely nothing when clicked on in the Chrome browser.
The jsp page source ...
1
vote
1
answer
176
views
Application properties for a struts2 java web application
I am new to Struts2 framework and I am trying to add some configuration properties like applicationId, timeout etc which will be used for calling some 3rd party APIs. In a Springboot project, we ...
0
votes
0
answers
18
views
Struts 2.5 upgrade is replacing & with & in jsp [duplicate]
Upgrading from Struts 2.3 to 2.5 version is working fine. But few jsp pages have issues while loading. & is getting replaced with & in jsp.
For eg. JSP code:
<s:form id="formId&...
0
votes
0
answers
15
views
struts.xml unable to fing the java class specified [duplicate]
i am working on a project where the front end is developed by struts2 and backend by hibernate.
the index.html contains links to all jsp page. the jsp pages contain html forms with struts tags. From ...
6
votes
4
answers
3k
views
HTTP Content-Security-Policy header not working correctly for script-src in Struts
I have a problem updating my version of struts struts2-core-2.5.30 project to struts2-core-6.1.1 so I began to receive an error indicating that the security policies have been violated, doing some ...
1
vote
0
answers
13
views
Struts2 avoid duplicate form submission on page reload [duplicate]
I'm setting up a project with struts2 for study but I'm having problems with the token tag to validate a duplicate form request, I always get the error
"Could not find token name in parameters.&...
0
votes
1
answer
190
views
How to use struts2 s:set variable inside s:select tag for list values?
I want to use a s:set variable inside s:select:
<s:set var="cityNY">NewYork</s:set>
<s:select name="cities" list="#{'%{#cityNY}':'%{#cityNY}'}" required=&...
0
votes
0
answers
100
views
Integrate Spring Security SAML2 Extension in Strut2 web application
I have a struts2 web application which use Spring Security SAML2 (Spring source) http://springsource.org/spring-security-saml) to get authentication of users in an external system AD FS.
I use spring-...
0
votes
1
answer
47
views
OGNL Indexing issue after migration to JBoss 7
I am currently migrating a legacy system using Struts2/OGNL from JBoss 6.1 to JBoss 7.4 where an issue with object indexing with OGNL is occurring.
The following function is causing expression setting ...
1
vote
2
answers
290
views
How to convert Bean to Object and how to retrieve Bean from Object in Java
I have following bean file.and I would like to put this bean to Map<String, Object> as key of bean.
Bean.java
@SuppressWarnings("serial")
public class bean implements Serializable {
...
1
vote
1
answer
174
views
Why session is not preserved in struts2
I would like to use values across multiple actions in strtus2 , concretelly, I developed following sample.
When I input like sample input in input tag, this value is passed to updateAction.java then ...
0
votes
0
answers
46
views
Servlet mapping for specific URL not working in Jersey 2
I am trying to use Jersey 2.x and have a servlet call "myapp", configuration on web.xml is as follows:
<servlet>
<servlet-name>myapp</servlet-name>
<servlet-...
1
vote
1
answer
112
views
Value of Value stack is changed after execute another action in Struts2
I have like following jsp.I send some data via form and execute Action,
case.jsp
before action:${CasePostFormBean.subject}
<s:action var="ServletHelperAction" name="login-user-to-...
0
votes
1
answer
84
views
Freemarker reference theme.properties in template
I am very new to this and have to migrate an existing web app (that I do not know much about) to Weblogic (12.2.1.4). I had to upgrade the version of struts (2.0.11.2 --> 2.3.1) which also came ...
0
votes
0
answers
46
views
What will be outputted and what logic executed from this Java code sent to an Apache Struts server?
I am trying to understand the Java within this HTTP request related to remote code execution of an older Struts2 framework vulnerability.
I get the basics of the Java objects/classes/methods in use, ...
0
votes
2
answers
113
views
Need to clear the error in the package of struts
AddBookAction.java
import com.opensymphony.xwork2.ActionSupport;
public class AddBookAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private String id, ...
1
vote
1
answer
127
views
How to access the nested tag of a struts tag?
I am using the following JavaScript code to set the value of an element.
document.getElementById('alert['+i+']').innerHTML = "alert";
The element is nested in a Struts set tag.
(The ID ...
0
votes
0
answers
31
views
Why is Struts2 spring plugin wiring internal spring classes by type when autowire config value is "no" [duplicate]
Struts version: 2.5.30
Struts Spring Configuration:
<constant name="struts.objectFactory" value="spring" />
<!-- spring injection wont auto happen. Need to ...
0
votes
0
answers
96
views
Struts Action responsible for rendering captcha does not work inside login page
I am having an issue with displaying a captcha in my login page. I use two Struts 2 actions, CaptchaAction and LoginAction. I call the CaptchaAction from img/src attribute using s:url struts2 tag. ...
1
vote
1
answer
229
views
JSON Response from Struts 2 not working with AJAX
I'm Using Ajax to get success response from Struts 2 but it ended up giving the response to error function and parse error for parsing JSON in Ajax.
Below is my code.
Action class - PropertyTesting....
1
vote
1
answer
58
views
How to fix action using the same id in JSP and JS?
I am sending a variable from JSP to java using this code :
<s:hidden name="checkActes" id="checkActes"></s:hidden>
<s:checkbox id="checkActes" ...
0
votes
0
answers
13
views
Struts OGNL expression [duplicate]
I have 2 struts hidden tags as follows:-
<s:hidden name="userList" id="userList"></s:hidden>
<s:hidden name="userId" id="tUserId" value="%{#...