'Back-End/Jsp'에 해당되는 글 14건

donaricano-btn

(2)Action Tags_useBean


1) jsp:useBean action tag

- The jsp:useBean action tag is used to locate or instantiate a bean class

- If bean object of the Bean class is already created, it doesn't create the bean depending on the scope

- If object of bean is not created, it instantiates the bean


Example

1_1. index.jsp

1_2. java


2) jsp: setProperty and jsp: getProperty

- The setProperty and getProperty action tags are used for developing web application with Java Bean

- It is a reusable software component that represents data


2_1. setProperty

- It you have to set all the values of incoming request in the bean

<jsp: setProperty name="bean" property="*"/>

If you have to set value of the incoming specific property

<jsp: setProperty name="bean" property="username"/>

- If you have to set a specific value in the property

<jsp: setProperty name="bean" property="username" value="Kunar"/>


2_2. getProperty

- The jsp: getProperty action tag returns the value of the property

<jsp: getProperty name="obj" property="name"/>


2_3. Example

- index.html

- process.jsp

- The part of the red is set for property

- The part of a green can get values

- Java




'Back-End > Jsp' 카테고리의 다른 글

[Jsp] MVC  (0) 2016.07.12
[Jsp] Expression Language(EL) - JSP  (0) 2016.07.08
[Jsp] (1)Action Tags_forward&include  (0) 2016.07.07
[Jsp] Exception  (0) 2016.07.07
[Jsp] Include & taglib directive  (0) 2016.07.07
블로그 이미지

리딩리드

,
donaricano-btn

Action Tags_1


- The action tags are used to control the flow between pages and to use Java Bean.

- The jsp:useBean, jsp:setProperty, jsp:getProperty tags are used for bean development


1. jsp:forward action tag

- The jsp:forward action tag is used to forward the request to another resource it may be jsp, html or another resource


1_1 without parameter


1_2. with parameter


2. jsp:include action tag

- The jsp:include action tag is used to include the content of another resource it may be jsp, html or servlet

- It is better for dynamic pages because there might be changes in future

Example   

1) index.jsp

2) process.jsp

3) result




'Back-End > Jsp' 카테고리의 다른 글

[Jsp] Expression Language(EL) - JSP  (0) 2016.07.08
[Jsp] (2)Action Tags_useBean  (0) 2016.07.08
[Jsp] Exception  (0) 2016.07.07
[Jsp] Include & taglib directive  (0) 2016.07.07
[Jsp] Page directives  (0) 2016.07.06
블로그 이미지

리딩리드

,

[Jsp] Exception

Back-End/Jsp 2016. 7. 7. 16:56
donaricano-btn

Exception 

- In JSP, there are two ways to perform exception handling

1) By errorPage and isErrorPage attributes of page directive

2) By <error-page> element in web.xml file



1. By the elements of page directive


1_1. index.jsp


1_2. process.jsp


1_3. error.jsp


1_4. result

2. By specifying the error-page element in web.xml

- This approach is better because you don't need to specify the errorPage attribute in each jsp page

- In this case, either specify exception-type or error code with the location element


2_1. web.xml

- If you want to handle any exception

- If you want to handle the exception for a specific error code


2_2 . error.jsp

'Back-End > Jsp' 카테고리의 다른 글

[Jsp] (2)Action Tags_useBean  (0) 2016.07.08
[Jsp] (1)Action Tags_forward&include  (0) 2016.07.07
[Jsp] Include & taglib directive  (0) 2016.07.07
[Jsp] Page directives  (0) 2016.07.06
[Jsp] Implicit Object_2  (0) 2016.07.06
블로그 이미지

리딩리드

,
donaricano-btn

Include & taglib directive


1. Include

- The include directive is used to include the contents of any resource it may be jsp file, html file or text file.


Example


2. Taglib

- The JSP taglib directive is used to define a tag library that defines many tags

- We can use the TLD(Tag Library Descriptor) file to define the tags


'Back-End > Jsp' 카테고리의 다른 글

[Jsp] (1)Action Tags_forward&include  (0) 2016.07.07
[Jsp] Exception  (0) 2016.07.07
[Jsp] Page directives  (0) 2016.07.06
[Jsp] Implicit Object_2  (0) 2016.07.06
[Jsp] Implicit Objects_1  (0) 2016.07.05
블로그 이미지

리딩리드

,