Skip to content

Commit

Permalink
Merge pull request #375 from apache/feature/struts-7
Browse files Browse the repository at this point in the history
Upgrades to Struts 7 & JakartaEE
  • Loading branch information
lukaszlenart authored Oct 11, 2024
2 parents 72344ad + f077f99 commit 32745ec
Show file tree
Hide file tree
Showing 156 changed files with 524 additions and 3,890 deletions.
4 changes: 2 additions & 2 deletions action-chaining/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>struts-examples</artifactId>
<groupId>org.apache.struts</groupId>
<version>1.1.0</version>
<version>2.0.0</version>
</parent>

<artifactId>action-chaining</artifactId>
Expand All @@ -28,7 +28,7 @@
</webApp>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scan>10</scan>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts-examples</artifactId>
<version>1.1.0</version>
<version>2.0.0</version>
</parent>

<artifactId>annotations</artifactId>
Expand Down Expand Up @@ -35,7 +35,7 @@
</webApp>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scan>10</scan>
</configuration>
</plugin>
</plugins>
Expand Down
7 changes: 2 additions & 5 deletions basic-struts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts-examples</artifactId>
<version>1.1.0</version>
<version>2.0.0</version>
</parent>

<artifactId>basic-struts</artifactId>
Expand All @@ -28,10 +28,7 @@
</webApp>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
</scanTargets>
<scan>10</scan>
</configuration>
</plugin>
</plugins>
Expand Down
17 changes: 10 additions & 7 deletions bean-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts-examples</artifactId>
<version>1.1.0</version>
<version>2.0.0</version>
</parent>

<artifactId>bean-validation</artifactId>
Expand All @@ -20,10 +20,16 @@
<version>6.2.3.Final</version>
</dependency>

<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>5.0.0</version>
</dependency>

<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.1-b12</version>
<artifactId>jakarta.el</artifactId>
<version>5.0.0-M1</version>
</dependency>

<dependency>
Expand All @@ -46,10 +52,7 @@
</webApp>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
</scanTargets>
<scan>10</scan>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,81 +1,78 @@
package org.apache.struts.edit.action;

import com.opensymphony.xwork2.ActionSupport;
import jakarta.validation.Valid;
import org.apache.struts.edit.model.Person;
import org.apache.struts.edit.model.State;
import org.apache.struts.edit.service.EditService;
import org.apache.struts.edit.service.EditServiceInMemory;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Acts as a controller to handle actions
* related to editing a Person.
* @author bruce phillips
*
* @author bruce phillips
*/
public class EditAction extends ActionSupport {

private static final long serialVersionUID = 1L;

private EditService editService = new EditServiceInMemory();
private final EditService editService = new EditServiceInMemory();

@Valid
private Person personBean;
private String[] sports = {"football", "baseball", "basketball"};
private String[] genders = {"male", "female", "not sure"};
private List<State> states;
private String[] carModelsAvailable = {"Ford", "Chrysler", "Toyota", "Nissan"};
@Valid
private Person personBean;
private final String[] sports = {"football", "baseball", "basketball"};
private final String[] genders = {"male", "female", "not sure"};
private final String[] carModelsAvailable = {"Ford", "Chrysler", "Toyota", "Nissan"};

public String execute() throws Exception {
editService.savePerson(getPersonBean());
public String execute() throws Exception {
editService.savePerson(getPersonBean());

return SUCCESS;
}
return SUCCESS;
}


public String input() throws Exception {
setPersonBean(editService.getPerson());
public String input() throws Exception {
setPersonBean(editService.getPerson());

return INPUT;
}
return INPUT;
}

public Person getPersonBean() {
return personBean;
}
public Person getPersonBean() {
return personBean;
}

public void setPersonBean(Person person) {
personBean = person;
}
public void setPersonBean(Person person) {
personBean = person;
}


public List<String> getSports() {
return Arrays.asList(sports);
}
public List<String> getSports() {
return Arrays.asList(sports);
}

public List<String> getGenders() {
public List<String> getGenders() {

return Arrays.asList(genders);
return Arrays.asList(genders);

}
}


public List<State> getStates() {
states = new ArrayList<>();
states.add(new State("AZ", "Arizona"));
states.add(new State("CA", "California"));
states.add(new State("FL", "Florida"));
states.add(new State("KS", "Kansas"));
states.add(new State("NY", "New York"));
public List<State> getStates() {
List<State> states = new ArrayList<>();
states.add(new State("AZ", "Arizona"));
states.add(new State("CA", "California"));
states.add(new State("FL", "Florida"));
states.add(new State("KS", "Kansas"));
states.add(new State("NY", "New York"));

return states;
}
return states;
}


public String[] getCarModelsAvailable() {
return carModelsAvailable;
}
public String[] getCarModelsAvailable() {
return carModelsAvailable;
}
}
Loading

0 comments on commit 32745ec

Please sign in to comment.