-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from apache/feature/struts-7
Upgrades to Struts 7 & JakartaEE
- Loading branch information
Showing
156 changed files
with
524 additions
and
3,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 40 additions & 43 deletions
83
bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.