Skip to content

Commit de8c754

Browse files
committed
Refactor(coding actions): Apply @StrutsParameter and update web.xml schema
- Apply required `@StrutsParameter` to action setters for Struts 7.0+ compatibility. - Update web.xml to Jakarta EE 10 namespace and Servlet 6.0 schema.
1 parent cf09a9e commit de8c754

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

coding-actions/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.apache.struts.helloworld.model.MessageStore;
44
import org.apache.struts2.ActionSupport;
5+
import org.apache.struts2.interceptor.parameter.StrutsParameter;
56

67
/**
78
* Acts as a Struts 2 controller that responds
@@ -33,6 +34,7 @@ public String getUserName() {
3334
return userName;
3435
}
3536

37+
@StrutsParameter
3638
public void setUserName(String userName) {
3739
this.userName = userName;
3840
}

coding-actions/src/main/webapp/WEB-INF/web.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
2+
<web-app id="WebApp_ID" version="6.0"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
36
<display-name>Coding Actions</display-name>
47
<welcome-file-list>
58
<welcome-file>index.jsp</welcome-file>

0 commit comments

Comments
 (0)