'jsp'에 해당되는 글 3건

  1. 2014.05.21 jsp:forward 와 request.sendRedirect()
  2. 2014.04.30 EL(Expression Language)$와 #
  3. 2014.04.29 POJO - Plain Old Java Object
Programming/jsp2014. 5. 21. 17:43
페이지를 자동으로 넘겨주는 방식으로 두가지가 존재하는데 가장 큰 차이점은
forward - 세션 유지 (기본객체 4가지를 재사용 함으로서 전부 유지됨)
response.sendRedirect(); - 세션 유지하지 않음(response 에서 하기 때문에)

[링크 : http://blog.daum.net/nakspite/7305451] 


기본적으로 아래의 방식으로 사용을 하지만
<jsp:forward page="index.mu" />

<%response.sendRedirect("index.mu");%>

스트럿츠에서 이렇게 액션으로 넘겨줄 경우 연결되지 않고 객체를 재사용하게 되므로,
index.jsp에서 다음의 내용만으로 사용해서 넘겨줄 경우 넘겨주는 페이지가 euc-kr을 쓸경우 인코딩이 깨지게 된다.
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:action name="index" executeResult="true" />

그러므로 넘겨줄 페이지의 인코딩을 넣어서 주거나 reDirect를 쓰는게 옳을 것으로 생각된다.
<%@ page contentType="text/html; charset=euc-kr"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:action name="index" executeResult="true" />

[링크 : http://stackoverflow.com/questions/16056166/jspforward-tag-forwards-to-struts-2-action

Posted by 구차니
Programming/jsp2014. 4. 30. 10:37
스트럿츠2를 보다 보니 이상한게 있어서 찾았는데
끄앙.. EL에 이런게 있었어?!?!? ㅠㅠ

Immediate and Deferred Evaluation Syntax
 Those expressions that are evaluated immediately use the ${} syntax. Expressions whose evaluation is deferred use the #{} syntax.

Immediate Evaluation
All expressions using the ${} syntax are evaluated immediately. These expressions can be used only within template text or as the value of a tag attribute that can accept runtime expressions.

Deferred Evaluation
Deferred evaluation expressions take the form #{expr} and can be evaluated at other phases of a page lifecycle as defined by whatever technology is using the expression. In the case of JavaServer Faces technology, its controller can evaluate the expression at different phases of the lifecycle, depending on how the expression is being used in the page.

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnahr.html


Value Expressions
Value expressions can be further categorized into rvalue and lvalue expressions. Rvalue expressions can read data but cannot write it. Lvalue expressions can both read and write data.

All expressions that are evaluated immediately use the ${} delimiters and are always rvalue expressions. Expressions whose evaluation can be deferred use the #{} delimiters and can act as both rvalue and lvalue expressions. Consider the following two value expressions:

${customer.name}
#{customer.name}

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnahu.html

Table 6-1 Definitions of Tag Attributes That Accept EL Expressions

Attribute Type

Example Expression

Type Attribute Definition

Dynamic

"literal"

<rtexprvalue>true</rtexprvalue>

Dynamic

${literal}

<rtexprvalue>true</rtexprvalue>

Deferred value

"literal"

<deferred-value>
   <type>java.lang.String</type>
</deferred-value>

Deferred value

#{customer.age}

<deferred-value>
   <type>int</type>
</deferred-value>

Deferred method

"literal"

<deferred-method>
   <method-signature>
      java.lang.String submit()
   </method-signature>
<deferred-method>

Deferred method

#{customer.calcTotal}

<deferred-method>
   <method-signature>
      double calcTotal(int, double)
   </method-signature>
</deferred-method>

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnaia.html]

# (deferred)
JSP 2.1 부터 지원하는 문법으로 JSF(JavaServer Face)에서 사용
$는 표현식이 실행되는 시점에 값을 계산하나
#는 값이 실제로 필요한 시점에 값을 계산한다.

[링크 : http://gangzzang.tistory.com/entry/JSP-표현-언어Expression-Language-또는-익스프레션-언어


'Programming > jsp' 카테고리의 다른 글

apache velocity  (0) 2014.05.19
JSP 서블릿 매핑  (0) 2014.05.08
POJO - Plain Old Java Object  (0) 2014.04.29
thread-safe singleton  (0) 2014.04.25
oreilly fileupload/multipart 라이브러리(jar)  (0) 2014.04.24
Posted by 구차니
Programming/jsp2014. 4. 29. 17:15
Servlet과 같이 상속을 받아서 쓰는게 아니기에
테스트에도 용이한 일반적인 클래스를 사용한 설계기법(?)에 대한 거창한 이름

2000년에 만들어진 용어라는데..
대학에서 처음 자바 배울때 이런 용어는 들어본적이 없다는게 함정...
머.. 그 당시에 JSP 한게 아니니...

[링크 : http://ko.wikipedia.org/wiki/Plain_Old_Java_Object]
[링크 : http://en.wikipedia.org/wiki/Plain_Old_Java_Object]

'Programming > jsp' 카테고리의 다른 글

JSP 서블릿 매핑  (0) 2014.05.08
EL(Expression Language)$와 #  (0) 2014.04.30
thread-safe singleton  (0) 2014.04.25
oreilly fileupload/multipart 라이브러리(jar)  (0) 2014.04.24
context.xml을 이용한 dbcp  (0) 2014.04.24
Posted by 구차니