Vous êtes sur la page 1sur 30

HandOnLabs_Portlet_Simple Login Portlet App with MySQL_v1.

RAI Dept, FPT Software HCM

Hands-On Lab
Lab Manual
Build a simple Login Portlet App with MySQL.

Page i

HandOnLabs_Portlet_Simple Login Portlet App with MySQL_v1.1

RAI Dept, FPT Software HCM

RECORD OF CHANGE
*A - Added M - Modified D Deleted
Effective Date

PIC

A*

Change Description

New Version

M, D
13-Feb-10

DoanNX.

Create.

1.0

14-Mar-10

DoanNX.

Modify.

1.1

Page
ii

HandOnLabs_Portlet_Simple Login Portlet App with MySQL_v1.1

RAI Dept, FPT Software HCM

Contents
Build a simple Login Portlet App with MySQL...............................................................................................i
LAB: BUILDING A SIMPLE LOGIN PORTLET APP WITH MYSQL...................................................................5
Lab Objectives...............................................................................................................................................5
Exercise 1 Create a simple portlet application SimpleLoginPortlet...............................................................6
1. Create a new Dynamic Web Project............................................................................................................6
1. In the next dialog, click Next button.............................................................................................................6
2. In this dialog, let modify the value of Context root: change from SimpleLoginPortlet to portletdriver/dt.
.......................................................................................................................................................................7
4. Create new portlet object: SimpleLoginPortlet.............................................................................................8
3. Input information for SimpleLoginPortlet portlet as following:.......................................................................8
6. Modify the JSPs..........................................................................................................................................9
Open the SimpleLoginPortlet\WebContent\WEB-INF\jsp\SimpleLoginPortlet_view.jsp file. You can use the
hot key Ctrl + Shift + R to open one file/resource quickly.................................................................................9
.......................................................................................................................................................................9
4. Refresh and then, run the project..............................................................................................................10
..........................................................................................................................................................................11
Exercise 2 Implement coding for SimpleLoginPortlet project......................................................................12
1. Create database query..............................................................................................................................12
In MySQL, create new database with name is simplelogin and run the script as following:...........................12
2. Import the necessary libraries into SimpleLoginPortlet project...................................................................12
There are two libraries needed to import, they are:.......................................................................................12
log4j-1.2.15.jar: this is used for log4j............................................................................................................12
mysql-connector-java-5.1.8-bin.jar: this is MySQL driver..............................................................................12
standard.jar: this is used for JSTL................................................................................................................12
jstl.jar: this is used for JSTL..........................................................................................................................12
Download these *.jar file and copy them to \WEB-INF\lib folder of SimpleLoginPortlet project, then refresh
project again.................................................................................................................................................12
....................................................................................................................................................................12
Add these libraries into the classpath of project............................................................................................13
Right click on project name, choose Build Path/Configure Build Path...........................................................13
....................................................................................................................................................................13
3. Create *.properties files............................................................................................................................14
Create db.properties file:.............................................................................................................................14
Right click on project name, choose New/File and input as following figure:.................................................14
....................................................................................................................................................................14
The content of db.properties file:.................................................................................................................14
....................................................................................................................................................................14
Create log4j.properties file:...........................................................................................................................14
Get the log4j.properties standard file from rai-server and copy it to the same location with db.properties file.
.....................................................................................................................................................................14
Search this line ...........................................................................................................................................14
....................................................................................................................................................................14
and changed to............................................................................................................................................14
....................................................................................................................................................................14
4. Create utility class(s).................................................................................................................................15
Create Connection class as following:..........................................................................................................15
Create a new class with name Constants to contain all project constants and the content of this class as
following (until now):......................................................................................................................................16
....................................................................................................................................................................16
And now the getConnection() method is changed as following:....................................................................17
....................................................................................................................................................................17
5. Create DTO class(s)..................................................................................................................................17
Create new class as following:.....................................................................................................................17
6. Create DAO class(s).................................................................................................................................19
Create new class as following:.....................................................................................................................19

Page
iii

HandOnLabs_Portlet_Simple Login Portlet App with MySQL_v1.1

RAI Dept, FPT Software HCM

7. Create BLO class(s)..................................................................................................................................21


Create new class as following:.....................................................................................................................21
...................................................................................................................................................................22
8. Create form/bean class(s).........................................................................................................................23
Create new class as following:.....................................................................................................................23
....................................................................................................................................................................24
9. Modify the JSP page.................................................................................................................................25
10. Modify SimpleLoginPortlet class.............................................................................................................26
Add new properties as following:..................................................................................................................26
....................................................................................................................................................................26
Modify processAction() method as following:................................................................................................26
....................................................................................................................................................................26
Now, add these new constants to Constants class:......................................................................................26
....................................................................................................................................................................26
Modify doView() method as following:..........................................................................................................27
....................................................................................................................................................................27
11. Deploy and run SimpleLoginPortlet project..............................................................................................27
Build entire project: right click on project name, choose Refresh, then choose Project menu/Clean submenu.
.....................................................................................................................................................................27
....................................................................................................................................................................28
Export to *.war file and deploy again into uPortal (you dont need to publish a new channel, the changes in
new *.war file will be updated automatically into the created channel)...........................................................28
Start server and browse to SimpleLoginPortlet in uPortal.............................................................................28
....................................................................................................................................................................28
....................................................................................................................................................................28
12. View log file.............................................................................................................................................28
Log file SimpleLoginPortlet.log is located at ${UPORTAL_TOMCAT_HOME}\ SimpleLoginPortlet.log..........28
Exercise 3 Implement a simple validation for SimpleLoginPortlet...............................................................29
1. With a web application, there is two way to validate the input data............................................................29
Validate at client-side: using Javascript, now a good choice is jQuery..........................................................29
Validate at server-side: execute validation at server-side.............................................................................29
This lab will execute follow the second way, validate at server-side..............................................................29
2. Modify SimpleLoginForm class to validate the input data...........................................................................29
For validation at server-side, we can put the validation code at any place, but, for clearly and exactly (about
meaning), we will implement validation in bean/form class............................................................................29
Add the validate() method with the content as following:...............................................................................29
....................................................................................................................................................................29
3. Modify a little in doView() method of SimpleLoginPortlet class...................................................................29
....................................................................................................................................................................29
4. Deploy again into uPortal and rerun..........................................................................................................30
....................................................................................................................................................................30

Page
iv

Lab: Building a simple Login Portlet App with MySQL


Estimated time to complete this lab: 45 minutes.
Lab Objective s
This lab will guide you to building a simple login application using:

Portlet .

3-layers model.

Log4j library to tracking your projects flow.

MySQL DBMS.

Using *.properties file in Java with Properties object and ResourceBundle object.

References:
Log4j: http://www.vipan.com/htdocs/log4jhelp.html

Exercise 1 Create a simple portlet application


SimpleLoginPortlet.
1. Create a new Dynamic Web Project.

Goining to menu File > New > Dynamic Web Project . Input the values as following
figure.

1. In the next dialog, click Next button.

2. In this dialog, let modify the value of Context root : change from SimpleLoginPortlet to
portletdriver/dt .

Click on Finish button. The structure of the project is:

4. Create new portlet object: SimpleLoginPortlet .

Going menu New > Other , select node Porlet\Java Porlet .

Click on Next button.

3. Input information for SimpleLoginPortlet portlet as following:

Click on Finish button. The structure of the project is:

6. Modify the JSPs.

Open the SimpleLoginPortlet\WebContent\WEB-INF\jsp\SimpleLoginPortlet_view.jsp file.


You can use the hot key Ctrl + Shift + R to open one file/resource quickly.

Modify the content of this file as following:


<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<portlet:defineObjects />
<b>
VIEW MODE

</b>

4. Refresh and then, run the project.

Righ-click on the project, select Run As > Run on Server .

If no available server exists, you will add a new server to run project.

3. Open the portlet in the browser.

Open the browser with the url: http://localhost:8080/portletdriver/dt

Then, deploy into uPortal, after you deploy it successfully in uPortal 1, browse to it:

How to publish one portlet into uPortal, please refer to HandOnLabs_Portlet_Create Hello Portlet App with
Eclipse_v2.0 lab.

Exercise 2 Implement coding for SimpleLoginPortlet project.


1. Create database query.

In MySQL, create new database with name is simplelogin and run the script as
following:

-- ----------------------------- Table structure for simpleuser


-- ---------------------------DROP TABLE IF EXISTS `simpleuser`;
CREATE TABLE `simpleuser` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sname` varchar(10) NOT NULL,
`spass` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------- Records
-- ---------------------------INSERT INTO `simpleuser` VALUES ('1', 'joanie', 'joanie');
2. Import the necessary libraries into SimpleLoginPortlet project.

There are two libraries needed to import, they are:


o

log4j-1.2.15.jar : this is used for log4j.

mysql-connector-java-5.1.8-bin.jar : this is MySQL driver.

standard.jar : this is used for JSTL.

jstl.jar : this is used for JSTL.

Download these *.jar file and copy them to \WEB-INF\lib folder of SimpleLoginPortlet
project, then refresh project again.

Add these libraries into the classpath of project.


o

Right click on project name, choose Build Path/Configure Build Path .

3. Create *.properties files.

Create db.properties file:


o

Right click on project name, choose New/File and input as following figure:

The content of db.properties file:


### For MySQL
jdbcDriver=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/simplelogin
jdbcUser=root
jdbcPassword=root

Create log4j.properties file:


o

Get the log4j.properties standard file from rai-server and copy it to the
same location with db.properties file.

Search this line


log4j.appender.R.File

and changed to
log4j.appender.R.File=SimpleLoginPortlet.log

4. Create utility class(s).

Create Connection class as following:

Content of this class:


package rai.util;
import java.io.InputStream;import java.sql.DriverManager;import java.util.Properties;
import org.apache.log4j.Logger; import java.util.ResourceBundle;
/**
* This class uses to get database connection.
* @author joanie
*/
public class Connection {
/**
* props property.
*/
private static Properties props = new Properties();
/**
* log property.
*/
private static Logger log = Logger.getLogger("Connection");

ject.

// load the content of db.properties file.


// first way: read db.properties file as input stream and load into Properties obstatic {
try {
InputStream is = Connection.class
.getResourceAsStream("/db.properties");
props.load(is);
} catch (Exception ex) {
// in case occur exception, log it.
log.error("Load db.properties", ex);
}

}
// second way: using ResourceBundle class: fast and easy.
private static ResourceBundle dbResource = ResourceBundle.getBundle("db");
public static java.sql.Connection getConnection() {
// load the driver and establish a connection.
try {
// using resource bundle to get jdbcDriver
String jdbcDriver = dbResource.getString(Constants.JDBD_DRIVER);
String jdbcUrl = dbResource.getString(Constants.JDBD_URL);
// using properties object.
String jdbcUser = props.getProperty(Constants.JDBD_USER);
String jdbcPassword = props.getProperty(Constants.JDBD_PASS);
Class.forName(jdbcDriver);
return (java.sql.Connection) DriverManager.getConnection(jdbcUrl,
jdbcUser, jdbcPassword);
} catch (Exception ex) {
// in case occur exception, log it.
log.error("getConnection", ex);
}
return null;
}

Create a new class with name Constants to contain all project constants and the
content of this class as following (until now):
package rai.util;
/**
* Constants of project.
* @author joanie
*
*/
public class Constants {
public static String
public static String
public static String
public static String
}

JDBD_DRIVER = "jdbcDriver";
JDBD_URL = "jdbcUrl";
JDBD_USER = "jdbcUser";
JDBD_PASS = "jdbcPassword";

And now the getConnection() method is changed as following:

public static java.sql.Connection getConnection() {


// load the driver and establish a connection.
try {
String jdbcDriver = props.getProperty(Constants.JDBD_DRIVER);
String jdbcUrl = props.getProperty(Constants.JDBD_URL);
String jdbcUser = props.getProperty(Constants.JDBD_USER);
String jdbcPassword = props.getProperty(Constants.JDBD_PASS);

Class.forName(jdbcDriver);
return (java.sql.Connection) DriverManager.getConnection(jdbcUrl,
jdbcUser, jdbcPassword);
} catch (Exception ex) {
// in case occur exception, log it.
log.error("getConnection", ex);
}
return null;

5. Create DTO class(s).

Create new class as following:

Content of this class:


package rai.dto;
/**
* This object uses to contain the data of 'simpleuser' table.
* @author joanie
*
*/
public class SimpleUserDTO {
private int id;
private String sname;
private String spass;
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the sname
*/
public String getSname() {
return sname;
}
/**
* @param sname the sname to set
*/
public void setSname(String sname) {
this.sname = sname;
}
/**
* @return the spass
*/
public String getSpass() {
return spass;
}
/**
* @param spass the spass to set
*/
public void setSpass(String spass) {
this.spass = spass;
}
}

6. Create DAO class(s).

Create new class as following:

Content of this class:


package rai.dao;
import
import
import
import
import
import

java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.sql.SQLException;
java.util.ArrayList;
java.util.List;

import org.apache.log4j.Logger;
import rai.dto.SimpleUserDTO;
import rai.util.Constants;
/**
* DAO class for SimpleLoginPortlet.
* @author joanie
*
*/
public class SimpleLoginDAO {
/**
* log property.
*/
private static Logger log = Logger.getLogger("SimpleLoginDAO");
/**
* Get the information of one specify user.
* @param name
* @param pass
* @return
*/
public List<SimpleUserDTO> getUser(String name, String pass) {
SimpleUserDTO dto;
List<SimpleUserDTO> result = new ArrayList<SimpleUserDTO>();
Connection conn = null;
String query = Constants.BLANK_VALUE;
ResultSet rs = null;
PreparedStatement pStat = null;
try {

// query command
query = "select * from simpleuser where sname=? and spass=?";
// get connection
conn = rai.util.Connection.getConnection();
// prepare statement
pStat = conn.prepareStatement(query);
pStat.setString(1, name);
pStat.setString(2, pass);
// execute query
rs = pStat.executeQuery();
// get result
while (rs.next()) {
dto = new SimpleUserDTO();
dto.setId(rs.getInt("id"));
dto.setSname(rs.getString("sname"));
dto.setSpass(rs.getString("spass"));
result.add(dto);
}
} catch (Exception sqlEx) {
log.error("SimpleLoginDAO.getUser " + sqlEx);
} finally {
try {
rs.close();
pStat.close();
conn.close();
} catch (SQLException sqlEx) {
log.error("SimpleLoginDAO.getUser " + sqlEx);
}
}
return result;
}

7. Create BLO class(s).

Create new class as following:

Content of this class:


package rai.blo;
import org.apache.log4j.Logger;
import rai.dao.SimpleLoginDAO;
import rai.dto.SimpleUserDTO;
/**
* Process business logic for SimpleLoginPortlet.
* @author joanie
*
*/
public class SimpleLoginBLO {
/**
* log property.
*/
private static Logger log = Logger.getLogger("SimpleLoginBLO");
/**
* DAO property.
*/
private SimpleLoginDAO dao = new SimpleLoginDAO();
/**
* Check whether user is valid.
* @param name
* @param pass
* @return
*/
public boolean isValidUser(String name, String pass) {
log.debug("isValidUser.start");
boolean res = true;
SimpleUserDTO dto = dao.getUser(name, pass);
if (dto == null) {
res = false;
}

log.debug("isValidUser.end");
return res;

Now, the structure of src folder like as following:

8. Create form/bean class(s).

Create new class as following:

Content of this class:


package rai.form;
/**
* This object uses to contain the value of JSP form.
* @author joanie
*
*/
public class SimpleLoginForm {
/**
* txtName property.
*/
private String txtName;
/**
* txtPass property.
*/
private String txtPass;
/**
* @return the txtName
*/
public String getSname() {
return txtName;
}
/**
* @param txtName the txtName to set
*/
public void setSname(String txtName) {
this.txtName = txtName;
}
/**
* @return the txtPass
*/
public String getSpass() {
return txtPass;
}
/**
* @param txtPass the txtPass to set
*/
public void setSpass(String txtPass) {
this.txtPass = txtPass;
}
}

Now, the structure of src folder like as following:

9. Modify the JSP page.

Modify the content of SimpleLoginPortlet_view.jsp file as following:


<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<portlet:defineObjects />
<script type="text/javascript">
function getForm(namespace, name) {
return document.forms[namespace + name];
}
function submitForm(namespace, name) {
var frm = getForm(namespace, name);
frm.txtAction.value = "login";
frm.submit();
}
</script>
<p style="">${sessionScope.errorMess}</p>
<form name="<portlet:namespace/>loginForm" action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="txtAction" />
<table>

<tr>

</tr>
<tr>
</tr>
<tr>

</form>

</tr>
</table>

<td>Username</td>
<td><input type="text" name="txtName"
value='${sessionScope.name}' /></td>
<td>Pass</td>
<td><input type="text" name="txtPass" /></td>
<td colspan="2"><input type="button" value="submit"
onclick="submitForm('<portlet:namespace/>','loginForm')" /></td>

Create new JSP page named Welcome.jsp in jsp folder and the content as following:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<script type="text/javascript">
function getForm(namespace, name) {
return document.forms[namespace + name];
}
function submitForm(namespace, name) {
var frm = getForm(namespace, name);
frm.txtAction.value = "back";
frm.submit();
}
</script>
<portlet:defineObjects />
SimpleLoginPortlet<br>
<h2>Hello ${sessionScope.name}!</h2>
<br />
<form name="<portlet:namespace/>backForm" action="<portlet:actionURL/>"
method="POST">
<input type="hidden" name="txtAction" />
<input type="button" value="Back"
onclick="submitForm('<portlet:namespace/>', 'backForm')" />
</form>

10. Modify SimpleLoginPortlet class.

Add new properties as following:


/**
* SimpleLoginForm.
*/
private SimpleLoginForm form;
/**
* SimpleLoginBLO property.
*/
private SimpleLoginBLO blo;
/**
* firstFlag.
*/
private boolean firstFlag = true;
/**
* action.
*/
private String action = Constants.BLANK_VALUE;
/**
* log property.
*/
private static Logger log = Logger.getLogger("SimpleLoginPortlet");

Modify processAction() method as following:


public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
firstFlag = false;
form = new SimpleLoginForm();
log.info("processAction.start");
if (request.getParameter("txtName") != null) {
form.setSname(request.getParameter("txtName").toString());
log.info("processAction.name=" + form.getSname());
}
if (request.getParameter("txtPass") != null) {
form.setSpass(request.getParameter("txtPass").toString());
log.info("processAction.pass=" + form.getSpass());
}
if (request.getParameter("txtAction") != null) {
action = request.getParameter("txtAction").toString();
log.info("processAction.action=" + action);
}
log.info("processAction.end");
}

Now, add these new constants to Constants class:

public static String LOGIN_ACTION = "login";


public static String BACK_ACTION = "back";
public static String LOGIN_VIEW_PATH = "/WEB-INF/jsp/SimpleLoginPortlet_view.jsp";
public static String WELCOME_VIEW_PATH = "/WEB-INF/jsp/Welcome.jsp";

public static String NAME_PORT_SESS_ATT = "name";


public static String PASS_PORT_SESS_ATT = "pass";
public static String ERR_MESS_PORT_SESS_ATT = "errorMess";

Modify doView() method as following:


public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PortletRequestDispatcher dispatcher;
response.setContentType("text/html");
log.info("doView.start");

// if user enters this page the first time


if (firstFlag) {
log.debug("doView.firstFlag = true");
dispatcher = getPortletContext().getRequestDispatcher(
Constants.LOGIN_VIEW_PATH);
dispatcher.include(request, response);
} else {
log.debug("doView.firstFlag = false");
if (action.equals(Constants.LOGIN_ACTION)) {
log.debug("doView.action = login");
blo = new SimpleLoginBLO();
// check whether isValidUser
if (blo.isValidUser(form.getSname(), form.getSpass())) {
// set user name
request.getPortletSession().setAttribute(
Constants.NAME_PORT_SESS_ATT, form.getSname(),
PortletSession.APPLICATION_SCOPE);
dispatcher = getPortletContext().getRequestDispatcher(
Constants.WELCOME_VIEW_PATH);
dispatcher.include(request, response);
} else {
// show error message in case user info is invalid
request.getPortletSession().setAttribute(
Constants.ERR_MESS_PORT_SESS_ATT,
"User info is invalid!",
PortletSession.APPLICATION_SCOPE);
// remove user name if any
request.getPortletSession().removeAttribute(
Constants.NAME_PORT_SESS_ATT);
dispatcher = getPortletContext().getRequestDispatcher(
Constants.LOGIN_VIEW_PATH);
dispatcher.include(request, response);
}
} else if (action.equals(Constants.BACK_ACTION)) {
// remove error message if any
request.getPortletSession().removeAttribute(
Constants.ERR_MESS_PORT_SESS_ATT);
log.debug("doView.action = back");
dispatcher = getPortletContext().getRequestDispatcher(
Constants.LOGIN_VIEW_PATH);
dispatcher.include(request, response);
}
}
log.info("doView.end");

11. Deploy and run SimpleLoginPortlet project.

Build entire project: right click on project name, choose Refresh , then choose
Project menu/Clean submenu .

Export to *.war file and deploy again into uPortal (you dont need to publish a new
channel, the changes in new *.war file will be updated automatically into the created
channel).

Start server and browse to SimpleLoginPortlet in uPortal .

12. View log file.

Log file SimpleLoginPortlet.log is located at ${UPORTAL_TOMCAT_HOME}\


SimpleLoginPortlet.log .

Exercise 3 Implement a simple validation for SimpleLoginPortlet.


1. With a web application, there is two way to validate the input data.

Validate at client-side: using Javascript, now a good choice is jQuery .

Validate at server-side: execute validation at server-side.

This lab will execute follow the second way, validate at server-side.

2. Modify SimpleLoginForm class to validate the input data.

For validation at server-side, we can put the validation code at any place, but, for clearly
and exactly (about meaning), we will implement validation in bean/form class.

Add the validate() method with the content as following:


/**
* Log property.
*/
private static Logger log=Logger.getLogger("SimpleLoginForm");
/**
* Validate the input data.
* @return
*/
public List<String> validate(RenderRequest request, RenderResponse response) {
log.debug("validate.start");
List<String> errorMess = new ArrayList<String>();
// check whether the txtName is blank
if (this.txtName.equals(Constants.BLANK_VALUE)) {
errorMess.add("Please input the Username!");
log.debug("validate.errorMess: Please input the Username!");
} else {
request.getPortletSession().setAttribute(
Constants.NAME_PORT_SESS_ATT, this.txtName,
PortletSession.APPLICATION_SCOPE);
}
// check whether the txtPass is blank
if (this.txtPass.equals(Constants.BLANK_VALUE)) {
errorMess.add("Please input the Password!");
log.debug("validate.errorMess: Please input the Password!");
}
log.debug("validate.end");
// return error message list
return errorMess;
}

3. Modify a little in doView() method of SimpleLoginPortlet class.

if (action.equals(Constants.LOGIN_ACTION)) {
log.debug("doView.action = login");
// validate the input data
List<String> errorLst = form.validate(request, response);
// in case there is no error
if (errorLst.isEmpty()) {
blo = new SimpleLoginBLO();

dispatcher = getPortletContext().getRequestDispatcher(
Constants.LOGIN_VIEW_PATH);
dispatcher.include(request, response);
}
} else {
// show error message in case username is blank
request.getPortletSession().setAttribute(
Constants.ERR_MESS_PORT_SESS_ATT, errorLst.get(0),
PortletSession.APPLICATION_SCOPE);
dispatcher = getPortletContext().getRequestDispatcher(
Constants.LOGIN_VIEW_PATH);
dispatcher.include(request, response);
}
} else if (action.equals(Constants.BACK_ACTION)) {

4. Deploy again into uPortal and rerun.