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

donaricano-btn

Page directives

- The jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet


1. Syntax

<%@ directive attribute="value" %>


2. page directive

- The page directive defines attributes that apply to an entire JSP page


2_1. Syntax

<%@ page attribute="value" %>


2_2. Attributes

          • import
          • contentType
          • extends
          • info
          • buffer
          • language
          • isELIgnored
          • isThreadSafe
          • autoFlush
          • session
          • pageEncoding
          • errorPage
          • isErrorPage


2_3. How to use

1) import

- It is used to import class, interface or all the members of a package

- It is similar to import keyword in java class 


Example


2) contentType

- The contentType attribute defines the MIME(Multipurpose Internet Mail Extension) type of the HTTP response

- Default value is "text/html; charset-ISO-8859-1"


Example

- When I reload the welcome.jsp page, welcome.jsp page is downloaded


3) buffer

- The buffer attribute sets the buffer size in kilobytes to handle output generated by the JSP page

- The default size of the buffer is 8Kb


Example


4) isELIgnored

 - We can ignore the Expression Language(EL) in jsp by the isELIgnored attribute

- By default its value is false i.e. Expression Language is enabled by default


Example


5) errorPage

- The errorPage attribute is used to define the error page, if exception occurs in the current page, it will be redirected to the error page


Example


6) isErrorPage

- This attribute is used to declare that the current page is the error page


Example


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

[Jsp] Exception  (0) 2016.07.07
[Jsp] Include & taglib directive  (0) 2016.07.07
[Jsp] Implicit Object_2  (0) 2016.07.06
[Jsp] Implicit Objects_1  (0) 2016.07.05
[Jsp] JSP tags  (0) 2016.07.05
블로그 이미지

리딩리드

,
donaricano-btn

Implicit Object_2


1. application implicit

- application is an implicit object of type ServletContext

- The instance of ServletContext is created only one by the web container when application or project is deployed on the server

- This object can be used to get initialization parameter from configuration file(web.xml)


1_1 index.html

1_2. web.xml


1_3. welcome.jsp


2. session implicit

- The Java developer can use this object to set, get or remove attriute or to get session info


2_1. index.html


2_2. welcome.jsp


2_3. second.jsp



3. pageContext implicit

- The pageContext object can be used to set, get or remove attribute from one of the following scopes

        • page
        • request
        • session
        • application      

3_1. index.html


3_2. welcome.jsp


3_3. second.jsp


4. page implicit

- This object is assigned to the reference of auto generated servlet class


Object page = this;


4_1. Example

<% (HttpServlet)page.log("message"); %>


- You can use this object directly in jsp

<% this.log("message"); %>


5. exception implicit

- This object can be used to print the exception. But it can only be used in error pages. 


5_1. error.jsp


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

[Jsp] Include & taglib directive  (0) 2016.07.07
[Jsp] Page directives  (0) 2016.07.06
[Jsp] Implicit Objects_1  (0) 2016.07.05
[Jsp] JSP tags  (0) 2016.07.05
[Jsp] JSP API  (0) 2016.07.05
블로그 이미지

리딩리드

,
donaricano-btn

 Implicit Objects_1

There are 9 jsp implicit objects. These objects are created by the web container that are available to all the jsp pages


1. out implicit object

- For writing any data to the buffer, JSP provides an implicit object named out


1_1 Servlet


1_2. JSP


2. request implicit object

- It can be used to get request information such as parameter, header information, remote address, server name, server port, content type, character encoding etc

- It can also be used to set, get and remove attributes from the jsp request scope

2_1. index.html


2_2. welcome.jsp


3. response implicit object

- It can be used to add or manipulate response such as redirect response to another resource, send error etc


3_1. index.html

]

3_2. welcome.jsp


4. config implicit object

- This object can be used to get initialization parameter for a particular JSP page


4_1. index.html



4_2. web.xml


4_3. welcome.jsp






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

[Jsp] Page directives  (0) 2016.07.06
[Jsp] Implicit Object_2  (0) 2016.07.06
[Jsp] JSP tags  (0) 2016.07.05
[Jsp] JSP API  (0) 2016.07.05
[Jsp] Cycle of Jsp  (0) 2016.07.04
블로그 이미지

리딩리드

,

[Jsp] JSP tags

Back-End/Jsp 2016. 7. 5. 15:32
donaricano-btn

JSP tag

- scriptlet tag

- expression tag

- declaration tag


1. scriptlet tag

<% java source code %>


1_1 Example

1) index.html

2) welcome.jsp


2. expression tag

- The code placed within Jsp expression tag is written to the output stream of the response

- It is mainly used to print the values of variable or method


<%= statement %>


2_1 Example


3. declaration tag

- The JSP declaration tag is used to declare fields and methods

- The code written inside the jsp declaration tag is placed outside the service() method  of auto generated servlet so it doesn't get memory at each request


<%! field or method declaration %>


3_1. Example


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

[Jsp] Page directives  (0) 2016.07.06
[Jsp] Implicit Object_2  (0) 2016.07.06
[Jsp] Implicit Objects_1  (0) 2016.07.05
[Jsp] JSP API  (0) 2016.07.05
[Jsp] Cycle of Jsp  (0) 2016.07.04
블로그 이미지

리딩리드

,