Programming/jsp2014. 3. 28. 21:46
<% 와는 다른 형태를 지닌 액션 태그란 녀석..
정식명칭인지 모르겠지만 은근히 검색이 잘 안나온다 ㅠㅠ

아마도.. 정식명칭은 JSP tag중 actions 인거 같기도 하고..
[링크 : http://docs.oracle.com/cd/E13222_01/wls/docs81/jsp/reference.html]

아무튼 request나 pagecontext와의 스코프는 테스트가 필요..
 
<jsp:include
include는 소스가 아닌 결과를 삽입
일반적으로 flush=false로 작업함 

<%@ include
include directive는 소스를 불러옴(차이점 주의!) 


<jsp:forward>
접속한 파일에서 다른 파일로 forward해서 다른 파일에서 응답을 처리함

Redirect - 느림, request 객체 재사용 불가
forward - 빠름, request 객체 재사용 가능URL이 변경되지 않음
[링크 : http://hdm6337.tistory.com/entry/Redirect-와-Dispatcher-Forward-의-차이] 

<jsp:include>
<jsp:param>
</jsp:include>
포함되는 문서에 파라미터 전달하기 

웹서버 레벨에서 header와 footer를 추가하는 기능 
<jsp-config>
   <jsp-property-group>
     <display-name>WebLogicServer</display-name>
     <url-pattern>*.jsp</url-pattern>
     <el-ignored>false</el-ignored>
     <scripting-invalid>false</scripting-invalid>
     <is-xml>false</is-xml>
     <include-prelude>/template/prelude.jspf</include-prelude>
     <include-coda>/template/coda.jspf</include-coda>
   </jsp-property-group>
 </jsp-config>
 
preludes (also called headers) and codas (also called footers)
[링크 : http://docs.oracle.com/cd/E11035_01/wls100/webapp/configurejsp.html] 




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

jsp action tag / <jsp:useBean  (0) 2014.03.31
jsp cookie  (0) 2014.03.31
jsp error 페이지 사이즈 제한(IE)  (0) 2014.03.27
jsp buffer  (0) 2014.03.27
jsp - page / request / session / applicaton  (0) 2014.03.27
Posted by 구차니
Programming/jsp2014. 3. 27. 21:01
jsp를 통해 에러 메시지를 변경할 수 있는데
HTTP/500 에러의 경우 RFC 문서에 512byte 이상이 되도록 규정이 되어 있고
512 바이트 이하일 경우 IE에 내장된 에러 메시지로 출력하게 된다고 한다.


 Several frequently-seen status codes have "friendly" error messages that Internet Explorer 5.x displays and that effectively mask the actual text message that the server sends. However, these "friendly" error messages are only displayed if the response that is sent to the client is less than or equal to a specified threshold. For example, to see the exact text of an HTTP 500 response, the content length must be greater than 512 bytes.

[링크 : http://support.microsoft.com/kb/294807

해결책으로는
1. ie 설정변경
  • In Internet Explorer 5.x and 6.x, on the Tools menu, click Internet Options.
  • On the Advanced tab, under the Browsing section, click to clear the Show friendly HTTP error messages check box, and then click OK. 
  • 2. 강제로 513 바이트 이상이 되도록 더미 데이터를 붙이는 방법이 있다.

    1번에서 Show friendly HTTP error message는 한글로 "HTTP 오류 메시지 표시"로 번역된 듯?


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

    jsp cookie  (0) 2014.03.31
    jsp 액션 태그 - <jsp:  (0) 2014.03.28
    jsp buffer  (0) 2014.03.27
    jsp - page / request / session / applicaton  (0) 2014.03.27
    JSP에서 euc-kr로 할 경우 저장이 안되는 한글이 있다?  (0) 2014.03.26
    Posted by 구차니
    Programming/jsp2014. 3. 27. 19:43
    jsp 파일에서 page를 통해 buffer를 설정이 가능하다.
    기본값은 8K 에 autoFlush(=true) 하도록 되어 있다.
    <%@ page contentType="text/html; charset=euc-kr"%>
    <%@ page buffer="16kb" autoFlush="false"%> 

    jsp 파일에서 설정된 내용은 java/class로 변환되는데 
    public void _jspService(HttpServletRequest request, HttpServletResponse response)
            throws java.io.IOException, ServletException {

        PageContext pageContext = null;
        HttpSession session = null;
        ServletContext application = null;
        ServletConfig config = null;
        JspWriter out = null;
        Object page = this;
        JspWriter _jspx_out = null;
        PageContext _jspx_page_context = null;


        try {
          response.setContentType("text/html; charset=EUC-KR");
          pageContext = _jspxFactory.getPageContext(this, request, response,
           null, true, 8192, true);
          _jspx_page_context = pageContext;
          application = pageContext.getServletContext();
          config = pageContext.getServletConfig();
          session = pageContext.getSession();
          out = pageContext.getOut();
          _jspx_out = out; 

    javax.servlet.jsp.JspFactory.getPageContext() 메소드를 통해 설정하게 된다.
    java.lang.Object
      extended by javax.servlet.jsp.JspFactory
     
    public abstract PageContext getPageContext(Servlet servlet,
                                               ServletRequest request,
                                               ServletResponse response,
                                               String errorPageURL,
                                               boolean needsSession,
                                               int buffer,
                                               boolean autoflush)
     
    [링크 : http://docs.oracle.com/javaee/5/api/javax/servlet/jsp/JspFactory.html#getPageContext(...)

    Posted by 구차니
    Programming/jsp2014. 3. 27. 19:32
    jsp의 scope가 있는데
    page는 하나의 페이지에 대해서 유효
    request는 HTTP request 에 대해서 유효
    session은 HTTP session에 대해서 유효
    applicatoin은 WAS에 대해서 유효한 값 범위를 지닌다.

    조금 다르게 설명을 하면
    page는 단일 jsp 파일 하나에 대한
    request는 jsp 파일 하나에서 링크로 이어지는 파일까지
    session은 웹 브라우저에서 서버로 접속한 세션이 유효한 동안(주로 로그인 인증에 사용)
    application은 웹 서버에서 서비스 하는 하나의 전체 홈페이지에 대해서 유효하다.


    There are four possible scopes:
    • scope="page" (default scope): The object is accessible only from within the JSP page where it was created. A page-scope object is stored in the implicitpageContext object. The page scope ends when the page stops executing.

      Note that when the user refreshes the page while executing a JSP page, new instances will be created of all page-scope objects.

    • scope="request": The object is accessible from any JSP page servicing the same HTTP request that is serviced by the JSP page that created the object. A request-scope object is stored in the implicit request object. The request scope ends at the conclusion of the HTTP request.

    • scope="session": The object is accessible from any JSP page that is sharing the same HTTP session as the JSP page that created the object. A session-scope object is stored in the implicit session object. The session scope ends when the HTTP session times out or is invalidated.

    • scope="application": The object is accessible from any JSP page that is used in the same Web application as the JSP page that created the object, within any single Java virtual machine. The concept is similar to that of a Java static variable. An application-scope object is stored in the implicitapplication servlet context object. The application scope ends when the application itself terminates, or when the JSP container or servlet container shuts down.

    [링크 : http://docs.oracle.com/cd/B14099_19/web.1012/b14014/genlovw.htm

    Scope is nothing but lifetime object 

    1.page - only in the particular jsp
    2.request- only in the jsp to which you forward your request object
    3.session- it is available until the session is invalidate(you can access it from any jsp)
    4.application-it is available until the web application or server shutdown(you can access it from any jsp).available through whole application
     
    [링크 : http://www.coderanch.com/.../certification/Page-Scope-request-Scope-session

    [링크 : http://docs.oracle.com/javaee/1.4/api/javax/servlet/jsp/PageContext.html]
    [링크 : http://www.java-samples.com/showtutorial.php?tutorialid=1009]

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

    jsp error 페이지 사이즈 제한(IE)  (0) 2014.03.27
    jsp buffer  (0) 2014.03.27
    JSP에서 euc-kr로 할 경우 저장이 안되는 한글이 있다?  (0) 2014.03.26
    JSP 기본 문법  (0) 2014.03.26
    웹 서버 및 서비스 개요(java/jsp)  (0) 2014.03.26
    Posted by 구차니
    Programming/jsp2014. 3. 26. 21:34


    이 녀석.. 아마도 완성형 코드인 euc-kr 에서 인식하지 못하기에
    유니코드인 utf-8로 해야지 저장이 가능한 듯

    이클립스에서 JSP 로 작업후 저장시 아래와 같이 UTF-8로 변환하길 권장한다.


    [링크 : http://tapito.tistory.com/173] 완성형 문자표
    [링크 : http://ko.wikipedia.org/wiki/EUC-KR ]

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

    jsp buffer  (0) 2014.03.27
    jsp - page / request / session / applicaton  (0) 2014.03.27
    JSP 기본 문법  (0) 2014.03.26
    웹 서버 및 서비스 개요(java/jsp)  (0) 2014.03.26
    Apache tomcat  (0) 2014.03.25
    Posted by 구차니
    Programming/jsp2014. 3. 26. 20:12
    문법이라고 하기에도 애매하지만..
    아무튼 치환자의 종료는 4가지가 있다.

     디렉티브 (Directive)  <%@ %> (import)
     스크립트릿 (Scriptlet)  <% %> (코드 영역 / 메소드 선언 불가)
     표현식 (Expression)  <%= %>(웹페이지로 출력)
     선언부 (Declaration)  <%! %> (메소드 선언 영역)
     
     
    JSP는 jsp 파일이 내부적으로 WAS를 통해 *.java로 변경되며 *.class로 컴파일 된다. 
    eclipse와 연동시 아래의 경로에 해당 class 파일과 java 파일이 생성된다.

    workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost 


    <%= %>의 경우는
    out.print()와 동일하게 작동한다.
    System.out.print()는 WAS의 콘솔로 출력하게 되니 주의!!!
    [링크 : http://www.jsptut.com/Scriptlets.jsp]

    out은 JspWriter의 out이다 ㄷㄷㄷ
    public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

        PageContext pageContext = null;
        HttpSession session = null;
        ServletContext application = null;
        ServletConfig config = null;
        JspWriter out = null;
     
    [링크 : http://stackoverflow.com/questions/10396347] 
    [링크 : http://docs.oracle.com/javaee/7/api/javax/servlet/jsp/JspWriter.html]

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

    jsp buffer  (0) 2014.03.27
    jsp - page / request / session / applicaton  (0) 2014.03.27
    JSP에서 euc-kr로 할 경우 저장이 안되는 한글이 있다?  (0) 2014.03.26
    웹 서버 및 서비스 개요(java/jsp)  (0) 2014.03.26
    Apache tomcat  (0) 2014.03.25
    Posted by 구차니
    Programming/jsp2014. 3. 26. 20:07
    WAS - Web Application Server (Apache Tomcat)

    tomcat 수동으로 구동시 반드시 설정해야 할 환경변수
    JAVA_HOME
    JRE_HOME
    CATALINA_HOME
    [링크 : http://tomcat.apache.org/]

    컴파일 된 파일들 삭제하는 방법

     

    JSTL/EL - javaEE의 기술 중 하나
    JSP Standard Tag Library/Expression Language

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

    jsp buffer  (0) 2014.03.27
    jsp - page / request / session / applicaton  (0) 2014.03.27
    JSP에서 euc-kr로 할 경우 저장이 안되는 한글이 있다?  (0) 2014.03.26
    JSP 기본 문법  (0) 2014.03.26
    Apache tomcat  (0) 2014.03.25
    Posted by 구차니
    Programming/Java2014. 3. 25. 21:33
    JNI(Java Native Interface)
    [링크 : http://docs.oracle.com/javase/6/docs/technotes/guides/jni/]
    [링크 : http://en.wikipedia.org/wiki/Java_Native_Interface]

    JNI를 통해 자바를 다른 언어에서
    혹은 다른 언어에서 자바를 호출할 수 있다.

    [링크 : http://deguls.tistory.com/entry/JNI-HelloWorld자바에서-C함수-호출] java에서 c 호출
    [링크 : http://scotthan.tistory.com/129]  c에서 java 호출

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

    JDNI - Java Directory & Naming Interface  (0) 2014.05.09
    jdk 1.5 - annotation / @  (0) 2014.05.08
    java TCP/UCP socket  (0) 2014.03.25
    java object serializable / ObjectInputStream + ObjectOutputStream  (0) 2014.03.24
    Java Input/OutputStream 관련  (0) 2014.03.21
    Posted by 구차니
    Programming/jsp2014. 3. 25. 17:12
    jakarta tomcat 이 프로젝트 종료되면서
    apache tomcat 으로 이전 된 듯?

    21 December 2011 - Jakarta Retired

    With no subprojects remaining, the Jakarta project has been retired to the Attic.

    [링크 : https://jakarta.apache.org/
        [링크 : https://jakarta.apache.org/site/news/news-2011-q4.html#20111221.1

    [링크 : http://en.wikipedia.org/wiki/Jakarta_Project]
    [링크 : http://en.wikipedia.org/wiki/Apache_Tomcat]

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

    jsp buffer  (0) 2014.03.27
    jsp - page / request / session / applicaton  (0) 2014.03.27
    JSP에서 euc-kr로 할 경우 저장이 안되는 한글이 있다?  (0) 2014.03.26
    JSP 기본 문법  (0) 2014.03.26
    웹 서버 및 서비스 개요(java/jsp)  (0) 2014.03.26
    Posted by 구차니
    Programming/Java2014. 3. 25. 00:33
    TCP는 소켓 자체가 서버용/클라이언트 용으로 나뉘지만
    UDP는 컨스트럭터의 인자에 따라서 서버용과 클라이언트용으로 구분된다.

    ServerSocket은
    accpet() 시에 다른 포트를 return 하게 되는데
    이는 서비스 포트를 접속용으로 사용하게 되면 다른 클라이언트들이 접속할 수 없게 되므로 서비스 포트를 비워두기 위함이다.

    Server ready...
    SRV SOCK localport 3333
    ACC SOCK localport 3333, port 2914
    Server ready...
    SRV SOCK localport 3333
    ACC SOCK localport 3333, port 2915 

    System.out.println("SRV SOCK localport " + serverSocket.getLocalPort());
    System.out.println("ACC SOCK localport " + socket.getLocalPort() + ", port " + socket.getPort()); 




    TCP
    Server Socket
    Socket accept() 
    Listens for a connection to be made to this socket and accepts it.
     

    [링크 : http://download.java.net/jdk8/docs/api/java/net/ServerSocket.html  

    ServerSocket serverS = new ServerSocket(port);
    Socket tcpSocket = serverS.accept();
    InputStream is = tcpSocket.getInputStream();
    OutputStream os = tcpSocket.getOutputStream();
    BufferedReader bufferR = new BufferedReader(new InputStreamReader(is));
    BufferedWriter bufferW = new BufferedWriter(new OutputStreamWriter(os)); 

    bufferR.read();

    bufferW.write();
    bufferW.flush(); 

    Client Socket
    Socket tcpSocket = new Socket(ip, port);
    InputStream is = tcpSocket.getInputStream();
    OutputStream os = tcpSocket.getOutputStream();
    BufferedReader bufferR = new BufferedReader(new InputStreamReader(is));
    BufferedWriter bufferW = new BufferedWriter(new OutputStreamWriter(os)); 

    bufferR.read();

    bufferW.write();
    bufferW.flush(); 

    [링크 : http://download.java.net/jdk8/docs/api/java/net/Socket.html
     


    UDP
    DatagramPacket(byte[] buf, int length) Constructs for receiving
    DatagramPacket(byte[] buf, int length, InetAddress address, int port) Constructs for sending
    [링크 : http://download.java.net/jdk8/docs/api/java/net/DatagramPacket.html]

    DatagramSocket(int port) Constructs a datagram socket and binds it to the specified port on the local host machine.
    DatagramSocket(int port, InetAddress laddr) Creates a datagram socket, bound to the specified local address.

    void receive(DatagramPacket p) Receives a datagram packet from this socket.
    void send(DatagramPacket p) Sends a datagram packet from this socket.
    [링크 : http://download.java.net/jdk8/docs/api/java/net/DatagramSocket.html] 

    DatagramSocket ds = new DatagramSocket(port);
    DatagramPacket dp = new DatagramPacket(buffer, buffer.length);

    ds.receive(dp);
    ds.send(dp);



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

    jdk 1.5 - annotation / @  (0) 2014.05.08
    java <-> c 상호호출  (0) 2014.03.25
    java object serializable / ObjectInputStream + ObjectOutputStream  (0) 2014.03.24
    Java Input/OutputStream 관련  (0) 2014.03.21
    java 8을 윈XP에 설치하자?  (2) 2014.03.20
    Posted by 구차니