Skip to content

anushadatta/Struts2-Login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Apache Struts 2: Login

Implementing a Java Web App with basic login functionality using MVC framework Apache Struts 2 and mySQL database.

Set Up

SQL Database

A prerequisite for local deployment of the Java Web Application is to set up the MySQL database to store the application User Model data. Execute the following commands to activate the SQL shell:


  ~$ mysql -u root -p
  ~$ (Enter Password):
  ~$ (copy/paste) cz3002.sql

Following this, ensure that the SQL script "cz3002.sql" is executed with root privileges to set up the required user authentication data records.

Local Deployment

Execute the following commands to run the webserver.


  ~$ mvn clean             // clean target directory created on previous build
  ~$ mvn jetty:run         // deploy web app at localhost:8080

Java Web App URL: http://localhost:8080/LoginStruts2/index.action

Login Credentials: Username: anushadatta, Password: test123

Directory Structure

β”œβ”€β”€ LoginStruts2
β”‚   β”œβ”€β”€ LoginStruts2.war
β”‚   β”œβ”€β”€ cz3002.sql
β”‚   β”œβ”€β”€ jetty-runner-9.4.7.v20170914.jar
β”‚   β”œβ”€β”€ pom.xml
β”‚   β”œβ”€β”€ src
β”‚   β”‚   └── main
β”‚   β”‚       β”œβ”€β”€ java
β”‚   β”‚       β”‚   β”œβ”€β”€ Controller
β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ LoginController.java
β”‚   β”‚       β”‚   β”‚   └── SQLController.java
β”‚   β”‚       β”‚   └── Model
β”‚   β”‚       β”‚       └── User.java
β”‚   β”‚       β”œβ”€β”€ resources
β”‚   β”‚       β”‚   β”œβ”€β”€ log4j2.xml
β”‚   β”‚       β”‚   └── struts.xml
β”‚   β”‚       └── webapp
β”‚   β”‚           β”œβ”€β”€ WEB-INF
β”‚   β”‚           β”‚   β”œβ”€β”€ lib
β”‚   β”‚           β”‚   β”‚   β”œβ”€β”€ javax.servlet-api-3.1.0.jar
β”‚   β”‚           β”‚   β”‚   β”œβ”€β”€ mysql-connector-java-5.1.49.jar
β”‚   β”‚           β”‚   β”‚   └── mysql-connector-java-8.0.22.jar
β”‚   β”‚           β”‚   └── web.xml
β”‚   β”‚           β”œβ”€β”€ home.jsp
β”‚   β”‚           └── login.jsp
β”œβ”€β”€ README.md

References

About

πŸ’» Basic Login with Apache Struts 2 & mySQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages