vinod sir struts 2 part 3

32
Prof. Vinod Pillai. [email protected] http://vinodthebest.wordpress.com www.youtube.com/vinodthebest

Upload: vinod-pillai

Post on 14-Dec-2014

1.888 views

Category:

Education


1 download

DESCRIPTION

Struts 2 Validation & Integrating Tiles Plugin

TRANSCRIPT

Page 1: Vinod sir struts 2   part 3

Prof. Vinod Pillai.

[email protected]

http://vinodthebest.wordpress.com

www.youtube.com/vinodthebest

Page 2: Vinod sir struts 2   part 3

Part – III

Application Development

2Prof. Vinod Pillai

Page 3: Vinod sir struts 2   part 3

Part – III : Struts 2 UI Tags & Integrating Tiles.

Validation

Using validate () Method

XML File Validation.

Struts 2 UI Tags.

Integrating Tiles Plug-in in Struts 2.

HttpServletRequest, HttpServletResponse, ServletContext

& HttpSession.

Prof. Vinod Pillai 3

Page 4: Vinod sir struts 2   part 3

6“Validation – Using validate () Method & XML”

Our Goal :

To create a Struts2 application with an index page. If userclicks the Login Button without entering the Username orPassword then it should display message appropriately errormessage.

4Prof. Vinod Pillai

Page 5: Vinod sir struts 2   part 3

Final Structure:

5Prof. Vinod Pillai

Page 6: Vinod sir struts 2   part 3

Index.jsp:

6Prof. Vinod Pillai

Page 7: Vinod sir struts 2   part 3

Struts.xml:

7Prof. Vinod Pillai

Page 8: Vinod sir struts 2   part 3

Action Class:

8Prof. Vinod Pillai

Page 9: Vinod sir struts 2   part 3

Welcome.jsp:

9Prof. Vinod Pillai

Page 10: Vinod sir struts 2   part 3

Second Option : XML File Validation

10Prof. Vinod Pillai

Page 11: Vinod sir struts 2   part 3

Final Structure:

11Prof. Vinod Pillai

Page 12: Vinod sir struts 2   part 3

LoginAction-validation.xml :

12Prof. Vinod Pillai

Page 13: Vinod sir struts 2   part 3

Action Class :

13Prof. Vinod Pillai

Page 14: Vinod sir struts 2   part 3

7“User Form”Our Goal :

To create a Struts2 application with an index page. If userclicks the Login Button it will redirect him to Welcome pagewhere some field values are coming from Action Classvariable & some major Form Fields.

14Prof. Vinod Pillai

Page 15: Vinod sir struts 2   part 3

Action Class :

15Prof. Vinod Pillai

Page 16: Vinod sir struts 2   part 3

Welcome.jsp:

16Prof. Vinod Pillai

Page 17: Vinod sir struts 2   part 3

8“Integrating Tiles Plug-in”

Our Goal :

To create a Struts2 application with an index page. As userclicks the Login Button it will redirect him to Welcome pagewhich having a common design layout which will becommon for all the pages.

17Prof. Vinod Pillai

Page 18: Vinod sir struts 2   part 3

Final Structure:

18Prof. Vinod Pillai

Page 19: Vinod sir struts 2   part 3

MainLayout.jsp:

19Prof. Vinod Pillai

Page 20: Vinod sir struts 2   part 3

Header.jsp:

Menu.jsp:

20Prof. Vinod Pillai

Page 21: Vinod sir struts 2   part 3

tiles.xml:

21Prof. Vinod Pillai

Page 22: Vinod sir struts 2   part 3

Index.jsp:

22Prof. Vinod Pillai

Page 23: Vinod sir struts 2   part 3

Struts.xml:

23Prof. Vinod Pillai

Page 24: Vinod sir struts 2   part 3

FirstPage.jsp:

SecondPage.jsp:

24Prof. Vinod Pillai

Page 25: Vinod sir struts 2   part 3

8 & 9“HttpServletRequest, HttpServletResponse, ServletContext

& HttpSession”Our Goal :

Getting ServletContext Object.

Getting HttpServletRequest Object.

Getting HttpServletResponse Object.

Getting HttpSession Object.

25Prof. Vinod Pillai

Page 26: Vinod sir struts 2   part 3

ApplicationAware/ServletContext:

26Prof. Vinod Pillai

Page 27: Vinod sir struts 2   part 3

SessionAware/HttpSession:

27Prof. Vinod Pillai

Page 28: Vinod sir struts 2   part 3

ServletRequestAware/HttpServletRequest:

28Prof. Vinod Pillai

Page 29: Vinod sir struts 2   part 3

ServletResponseAware :

29Prof. Vinod Pillai

Page 30: Vinod sir struts 2   part 3

Part – III : Struts 2 UI Tags & Integrating Tiles.

Validation

Using validate () Method

XML File Validation.

Struts 2 UI Tags.

Integrating Tiles Plug-in in Struts 2.

HttpServletRequest, HttpServletResponse, ServletContext

& HttpSession.

Prof. Vinod Pillai 30

Page 31: Vinod sir struts 2   part 3

Part – III

Completed

31Prof. Vinod Pillai

Page 32: Vinod sir struts 2   part 3

Thank You

[email protected]

32Prof. Vinod Pillai