Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

3/4/2021 Project Details | Project 2 - Building a dynamic website | PRJ321x_01_EN Courseware | FUNiX

FUNiX: PRJ321x_01_EN Web-based Java Applications Help

Course  Module 2: Form Handling & Beans  Project 2 - Building a dynamic website 
Project Details

Project Details
 Bookmark this page

How to complete the project?


To have knowledge to do this project, you need the following knowledge:

1. Knowledge of JSP’s directives. The directive needed to do a layout in JSP is @Include,


where you will store a JSP file shared in a specific JSP. For example:

<html><head><title>JSP Templates</title></head>

<body background='graphics/background.jpg'>

<table>

<tr valign='top'><td><%@include file='sidebar.html'%></td>

<td><table>

<tr><td><%@include file='header.html'%></td></tr>

<tr><td><%@include file='introduction.html'%></td></tr>

<tr><td><%@include file='footer.html'%></td></tr>

</table>

</td>

</tr>

</table>
Ask Mentors

https://courses.funix.edu.vn/courses/course-v1:FUNiX+PRJ321x_01_EN+2020_T1/courseware/b44118bccb6a453498290e47378a6f86/3c9f4f2ffda64b… 1/4
3/4/2021 Project Details | Project 2 - Building a dynamic website | PRJ321x_01_EN Courseware | FUNiX

</body></html> Question (*)


(Source: https://www.javaworld.com/article/2076174/java-web-development/jsp-
templates.html)

In this example, this is considered a data representation page; however, there are four
other pages included: sidebar.html, header.html, introduction.html and footer.html. These
pages are permanent, containing general information on all pages and contained within
every page that shares this interface.

2. In the previous project, you learned how to get user-submitted data. It includes:

Get data by keyword: request.getParameter(“name”) It usually returns a String


data type.

When doing on the form, you can identify the keyword METHOD as POST or GET to


send data in the corresponding method.

Note: When retrieving data using the GET method, all parameters are separated by a
"&" in the address bar, which is often called a "query string".

In the Servlet, JSP to process data, you transfer the data obtained from the String type
to the appropriate data type. For example, from String -> Intenger: int age =
Integer.parseInt(ageString ); 

Note: It is important to be aware of the try-catch problem.

From here you can process data in the Java language, and take full advantage of the
power of the platform.

3. Navigation in JSP / Servlet.

To navigate using Forward in the JSP / Servlet, you will need to use the
keyword requestDispatcher.forward(request,response). For example:

Ask Mentors

https://courses.funix.edu.vn/courses/course-v1:FUNiX+PRJ321x_01_EN+2020_T1/courseware/b44118bccb6a453498290e47378a6f86/3c9f4f2ffda64b… 2/4
3/4/2021 Project Details | Project 2 - Building a dynamic website | PRJ321x_01_EN Courseware | FUNiX

You also need to distinguish the difference between sendRedirect and forward for use
in different situations.

Useful resources

Directives: https://www.javatpoint.com/jsp-page-directive

Example of layout: https://www.javaworld.com/article/2076174/java-web-
development/jsp-templates.html

Form processing:

https://www.tutorialspoint.com/servlets/servlets-form-data.htm

http://www.codejava.net/java-ee/servlet/handling-html-form-data-with-java-servlet

https://www.javaworld.com/article/2076076/java-web-development/server-side-java--
advanced-form-processing-using-jsp.html?page=5

Ask Mentors

https://courses.funix.edu.vn/courses/course-v1:FUNiX+PRJ321x_01_EN+2020_T1/courseware/b44118bccb6a453498290e47378a6f86/3c9f4f2ffda64b… 3/4
3/4/2021 Project Details | Project 2 - Building a dynamic website | PRJ321x_01_EN Courseware | FUNiX

 

Ask Mentors

https://courses.funix.edu.vn/courses/course-v1:FUNiX+PRJ321x_01_EN+2020_T1/courseware/b44118bccb6a453498290e47378a6f86/3c9f4f2ffda64b… 4/4

You might also like