Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 국제화
- mybatis
- struts2
- 에러페이지
- paint
- oracle
- 이클립스
- 클래스
- Android
- 전화걸기
- 배열
- 예외처리
- 메소드
- JSP
- 안드로이드
- Spring
- JavaScript
- Graphic
- OGNL
- 생성자
- Eclips
- 기본
- layout
- 오버로딩
- AWT
- HTML
- 메서드
- Menu
- Java
- 어노테이션
Archives
- Today
- Total
note
struts2 네임스페이스 사용 본문
파일 위치
struts.xml
<!-- 3. 네임스페이스 사용 --> <package name="ch4" namespace="/ch4" extends="struts-default"> <action name="helloWorld03" class="com.ch4.action.HelloWorld"> <result name="success">/ch4/hello.jsp</result> </action> </package>
HelloWorld.java
package com.ch4.action; import com.opensymphony.xwork2.Action; public class HelloWorld implements Action{ private String message; //struts2 시스템에서 getMessage()를 호출한다 public String getMessage() { return message; } @Override public String execute() throws Exception { message ="몽롱한 화요일"; return SUCCESS; } }
hello.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>네임스페이스 사용</title> </head> <body> ${message} </body> </html>
대문자 SUCESS는 소문자 sucess를 return함