자바스크립트2013. 6. 20. 10:19

new Ajax.Request

Posted by 선한열심
JAVA OPEN API2013. 6. 19. 18:20

네이버  : "sitemesh(사이트메쉬) 해보기" 검색하면 나옴

http://cafe.naver.com/buldon/2005

 

1. jar파일 다운로드 ( http://opensymphony.com/  프로젝트 임 )

  http://www.sitemesh.org/ - > download  ( sitemesh-버전.jar , 최신 2.4.2 )

 

2. web.xml 설정 추가

 <!-- Sitemesh Configration -->
 <filter>
  <filter-name>sitemesh</filter-name>
  <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>sitemesh</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

3. /WEB-INF/decorators.xml 설정

 <?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators">
    <decorator name="basic-theme" page="basic-theme.jsp">
        <pattern>/data/*</pattern>
    </decorator>
</decorators>

4. basic-theme.jsp 파일

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Café Mirabeau</title>
</head>
<body>
    <h1>Header</h1>
    <p><b>Navigation</b></p>   
    <hr />
    <decorator:body />    
    <hr />
    <h1>Footer</h1>
</body>
</html>

 

5. /data/hour.jsp      ( 화면에 보일때는 basic-theme.jsp 안에 hour.jsp파일의 body가 자동으로 들어가서 보인다 )

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Hours</title>
</head>
<body>
    <h1>Weekdays</h1>
    <p>5:00pm - 10:00pm</p>
    <p>Weekends</p>
    <p>5:00pm - 10:00pm</p>
</body>
</html>

 

sitemesh에서 제공하는 파일   cafe.war

Posted by 선한열심
JSP2013. 6. 19. 14:34

1. ~.tld 파일 설정

    기본적으로 web.xml 에 taglib 를 등록하지만 WEB-INF/ 밑에 ~.tld 파일이 있을 경우 따로 설정하지 않아도 된다.

   JSP에서는 tld파일의 taglib 태그의 uri 태그 값으로 불러와서 사용하면 됨

  예)  tld파일 : WEB-INF/ 밑에 있어야함

        tld파일안에  : <uri>net.ucware.tags</uri>

        jsp : <%@ taglib prefix="ast" uri="net.ucware.tags" %>

 

2. 커스텀 태그 정리 중....

HearderTag.java

public class DefaultConfigTag extends TagSupport

    private String var;
    public void setVar(String var) {
        this.var = var;
    } 
 
    public int doStartTag() throws JspException {
        String value = "aaa";
        pageContext.setAttribute(var, value);
       
        아니면
       
        JspWriter out = pageContext.getOut();
        ou.print("aaa");
        return SKIP_BODY;
    }
}

<exam:mutiply op1="2" start="1" end="9" >

</exam>

<exam:mutiply op1="2" start="1" end="9" >

 ${pageContext.op1} * ${pageContext.op2} =  ${pageContext.op1 * pageContext.op2} <br>   <=== 몸체라고함

</exam:multiply>


Return 값 종류

doStartTag()  

    SKIP_BODY                  : 몸체 내용을 처리하지 않는다

    EVAL_BODY_INCLUDE : 몸체 내용을 처리한 결과를 출력한다.

doAfterBody()  

    EVAL_BODY_AGAIN  이면 몸체 다시 실행 do{ }while(조건) 처럼

    SKIP_BODY                  : 몸체 내용을 처리하지 않는다

 



Posted by 선한열심