JSP Bean Introduction

mobdescriptiveSoftware and s/w Development

Oct 28, 2013 (3 years and 7 months ago)

119 views

COMPUTING SUBJECT:

JSP
basics of
B
eans


TYPE:

Assignment


IDENTIFICATION:

JSP

Beans


COPYRIGHT:

Michael Claudius


LEVEL:

Easy


TIME CONSUMPTION:

2 hours


EXTENT:

50 lines


OBJECTIVE:

JSP expressions, scriptlets, declaration


PRECONDITIONS:

Core Servlets &
JSP

Ch.

1
0&14


COMMANDS:


IDENTIFICATION:
JSP
BEAN
/MC


The Mission

You are to make a
Web project based on some .jsp page files and a few Java

beans

classes in a
related package.
This assignment is best done in groups of two for discussion purposes.


Useful

links for this assignment


http://www..coreservlets.com


Site for all kind of information

http://volume1.coreservlets.com/archive/index.html

Code examples from the book

Ch. 14.



1
.
Create

a Web project

In your favourite editor create
a new project JSP
Beans
Project of the category Web.

Choose the Category to
Web and Web Application.

In Source Package create a new package named “coreservlets”.

F
irst step first…


2
.
Downloading

You are now to
use some prede
fined .jsp and .java files (Ch14 JSP Files.zip and Ch14

Java Files.zip)
which you can download from your teacher’s home page.

Unzip the .jsp files to the Web Pages folder.

Unzip the .java files
to the coreservlets package.


Note:
In the next assignments you are to
compile
run various programs but the most important is
that you try to understand the code;

e.g.

by answering the questions given.


3
. JSP
Bean UseBean

Compile and run
StringBean.jsp

What is the syntax for
<
jsp:useBean
>
?


4.Understanding the compilation. JSP/Bean/Servlet corespondence

Open Windows explorer and in the project folder JSP
Bean
P
roj
ect search for the file StringB
ean
.

Notice the StringBean_jsp.java file.

Try to open it in a

simple editor like TextPad

Look at the code and notice the method


_jspService(HttpServletRequest request, HttpServletResponse response)


Find

the object of the java bean class coreservlets.Stringbean.java.

Compare with StringBean.jsp code.

H
ow is the
St
ringBean Class

used in Stringbean.jsp file and in servlet Stringbean _jsp file ?


5. JSP
Bean property

C
ompile,
run
and investigate
SaleEntry1.jsp.

What is the syntax for
<jsp:
set
property>
?


Turn page


6. JSP Bean sharing

Look at coreservlets.AccessCou
nt.java

Compile and run SharedCount1.jsp. Explain

what goes on
!

How is s
cope

defined
?


Then look at BakedBeanXXX.jsp files.