Repository: struts-examples Updated Branches: refs/heads/master 15c545e0d -> 04d6d8388
changed formatting of java classes Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/eb862b6c Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/eb862b6c Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/eb862b6c Branch: refs/heads/master Commit: eb862b6ce981af44f3220004ef285c74be41e59b Parents: 15c545e Author: Stefaan Dutry <stefaan.du...@gmail.com> Authored: Tue Apr 25 21:02:32 2017 +0200 Committer: Stefaan Dutry <stefaan.du...@gmail.com> Committed: Tue Apr 25 21:02:32 2017 +0200 ---------------------------------------------------------------------- .../helloworld/action/HelloWorldAction.java | 109 +++++++++---------- .../struts/helloworld/model/MessageStore.java | 35 +++--- .../apache/struts/register/action/Register.java | 40 +++---- .../apache/struts/register/model/Person.java | 31 ++---- 4 files changed, 96 insertions(+), 119 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts-examples/blob/eb862b6c/form-processing/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java ---------------------------------------------------------------------- diff --git a/form-processing/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java b/form-processing/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java index 1285010..39eec33 100644 --- a/form-processing/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java +++ b/form-processing/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java @@ -13,67 +13,64 @@ import org.apache.struts.helloworld.model.MessageStore; */ public class HelloWorldAction extends ActionSupport { - private static final long serialVersionUID = 1L; - - /** - * The model class that stores the message - * to display in the view. - */ - private MessageStore messageStore; - - private static int helloCount = 0; - - public int getHelloCount() { - return helloCount; - } + private static final long serialVersionUID = 1L; + + /** + * The model class that stores the message + * to display in the view. + */ + private MessageStore messageStore; + + private static int helloCount = 0; + + public int getHelloCount() { + return helloCount; + } - public void setHelloCount(int helloCount) { - HelloWorldAction.helloCount = helloCount; - } - - private String userName; + public void setHelloCount(int helloCount) { + HelloWorldAction.helloCount = helloCount; + } + + private String userName; - public String getUserName() { - return userName; - } + public String getUserName() { + return userName; + } - public void setUserName(String userName) { - this.userName = userName; - } + public void setUserName(String userName) { + this.userName = userName; + } - /* - * Creates the MessageStore model object, - * increase helloCount by 1 and - * returns success. The MessageStore model - * object will be available to the view. - * (non-Javadoc) - * @see com.opensymphony.xwork2.ActionSupport#execute() - */ - public String execute() throws Exception { - - messageStore = new MessageStore() ; - - //Action included a query string parameter of userName - //or a form field with name of userName - if (userName != null) { - - messageStore.setMessage( messageStore.getMessage() + " " + userName); - - } - - helloCount++; - - return SUCCESS; - } + /* + * Creates the MessageStore model object, + * increase helloCount by 1 and + * returns success. The MessageStore model + * object will be available to the view. + * (non-Javadoc) + * @see com.opensymphony.xwork2.ActionSupport#execute() + */ + public String execute() throws Exception { + messageStore = new MessageStore() ; + + //Action included a query string parameter of userName + //or a form field with name of userName + if (userName != null) { + + messageStore.setMessage( messageStore.getMessage() + " " + userName); + + } + + helloCount++; + + return SUCCESS; + } - public MessageStore getMessageStore() { - return messageStore; - } + public MessageStore getMessageStore() { + return messageStore; + } - public void setMessageStore(MessageStore messageStore) { - this.messageStore = messageStore; - } - - + public void setMessageStore(MessageStore messageStore) { + this.messageStore = messageStore; + } } http://git-wip-us.apache.org/repos/asf/struts-examples/blob/eb862b6c/form-processing/src/main/java/org/apache/struts/helloworld/model/MessageStore.java ---------------------------------------------------------------------- diff --git a/form-processing/src/main/java/org/apache/struts/helloworld/model/MessageStore.java b/form-processing/src/main/java/org/apache/struts/helloworld/model/MessageStore.java index b7fceeb..d732494 100644 --- a/form-processing/src/main/java/org/apache/struts/helloworld/model/MessageStore.java +++ b/form-processing/src/main/java/org/apache/struts/helloworld/model/MessageStore.java @@ -6,26 +6,23 @@ package org.apache.struts.helloworld.model; * */ public class MessageStore { - - private String message; - - public MessageStore() { - - setMessage("Hello Struts User"); - } + + private String message; + + public MessageStore() { + setMessage("Hello Struts User"); + } - public String getMessage() { - return message; - } + public String getMessage() { + return message; + } - public void setMessage(String message) { - this.message = message; - } - - public String toString() { - - return message + " (from toString)"; - - } + public void setMessage(String message) { + this.message = message; + } + + public String toString() { + return message + " (from toString)"; + } } http://git-wip-us.apache.org/repos/asf/struts-examples/blob/eb862b6c/form-processing/src/main/java/org/apache/struts/register/action/Register.java ---------------------------------------------------------------------- diff --git a/form-processing/src/main/java/org/apache/struts/register/action/Register.java b/form-processing/src/main/java/org/apache/struts/register/action/Register.java index 82cde07..2a2a3d6 100644 --- a/form-processing/src/main/java/org/apache/struts/register/action/Register.java +++ b/form-processing/src/main/java/org/apache/struts/register/action/Register.java @@ -10,30 +10,24 @@ import org.apache.struts.register.model.Person; * */ public class Register extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private Person personBean; + + private static final long serialVersionUID = 1L; + + private Person personBean; - public String execute() throws Exception { - - //call Service class to store personBean's state in database - - return SUCCESS; - - } - - public Person getPersonBean() { - - return personBean; - - } - - public void setPersonBean(Person person) { - - personBean = person; - - } + public String execute() throws Exception { + //call Service class to store personBean's state in database + + return SUCCESS; + } + + public Person getPersonBean() { + return personBean; + } + + public void setPersonBean(Person person) { + personBean = person; + } } http://git-wip-us.apache.org/repos/asf/struts-examples/blob/eb862b6c/form-processing/src/main/java/org/apache/struts/register/model/Person.java ---------------------------------------------------------------------- diff --git a/form-processing/src/main/java/org/apache/struts/register/model/Person.java b/form-processing/src/main/java/org/apache/struts/register/model/Person.java index 3020bbb..5393460 100644 --- a/form-processing/src/main/java/org/apache/struts/register/model/Person.java +++ b/form-processing/src/main/java/org/apache/struts/register/model/Person.java @@ -6,56 +6,45 @@ package org.apache.struts.register.model; * @author bruce phillips * */ -public class Person -{ +public class Person { private String firstName; private String lastName; private String email; private int age; - public String getFirstName() - { + public String getFirstName() { return firstName; } - public void setFirstName(String firstName) - { + public void setFirstName(String firstName) { this.firstName = firstName; } - public String getLastName() - { + public String getLastName() { return lastName; } - public void setLastName(String lastName) - { + public void setLastName(String lastName) { this.lastName = lastName; } - public String getEmail() - { + public String getEmail() { return email; } - public void setEmail(String email) - { + public void setEmail(String email) { this.email = email; } - public int getAge() - { + public int getAge() { return age; } - public void setAge( int age) - { + public void setAge(int age) { this.age = age; } - - public String toString() - { + public String toString() { return "First Name: " + getFirstName() + " Last Name: " + getLastName() + " Email: " + getEmail() + " Age: " + getAge() ; }