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
- 클래스
- struts2
- 메서드
- HTML
- 전화걸기
- paint
- 오버로딩
- Java
- Menu
- OGNL
- 이클립스
- JavaScript
- 메소드
- JSP
- layout
- Graphic
- 생성자
- 국제화
- Spring
- 안드로이드
- AWT
- 에러페이지
- oracle
- Eclips
- Android
- 어노테이션
- 배열
- 기본
- 예외처리
- mybatis
Archives
- Today
- Total
note
Struts2 include 사용 본문
struts.xml
<include file="struts-ch4.xml" />
struts-ch4.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="ch4-4" namespace="/ch4" extends="struts-default"> <!-- 데이터 전송 --> <action name="helloWorld3" class="com.ch4.action.HelloWorld3"> <interceptor-ref name="params" /> <result name="success">hello.jsp</result> </action> </package> </struts>
HelloWorld3.java
package com.ch4.action;
import com.opensymphony.xwork2.Action;
public class HelloWorld3 implements Action{
private String message;
private String name;
//getMessage()역할은 request.setAttribute("message",message)
public String getMessage() {
return message;
}
//setName() 역할은 request.getParameter("name");
public void setName(String name) {
this.name = name;
}
@Override
public String execute() throws Exception {
message = "Hello, "+name;
return SUCCESS;
}
}
name3.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
데이터 전송
멤버변수와 form태그의 이름을 동일하게 해놓는다
'JSP > Struts2' 카테고리의 다른 글
Struts2 ActionSupport를 사용하여 유효성 검사(Interceptor) (1) | 2012.02.21 |
---|---|
Struts2 유효성 검사 (0) | 2012.02.21 |
Struts2 와일드카드 디폴트 (0) | 2012.02.21 |
struts2 default-action-ref (에러페이지) (0) | 2012.02.21 |
struts2 ActionSupport를 이용한 JSP 호출 (form만 요청할페이지에 사용) (0) | 2012.02.21 |