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 |
Tags
- 예외처리
- paint
- mybatis
- 생성자
- JavaScript
- AWT
- Eclips
- 이클립스
- 어노테이션
- oracle
- struts2
- Menu
- JSP
- Graphic
- 메소드
- 안드로이드
- HTML
- 오버로딩
- 국제화
- layout
- Android
- 에러페이지
- 전화걸기
- 기본
- 배열
- OGNL
- 메서드
- Java
- Spring
- 클래스
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함