반응형
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Netty
- vue.js
- MySQL
- WebLogic
- Selenium
- docker
- Redis Sentinel
- Spring Open Feign
- docker compose mysql
- redis
- weblogic 10
- argo cd
- Hibernate
- ChannelPipeline
- Docker Compose
- spring boot redis
- QueryDSL
- spring cloud
- docker-compose
- grafana
- jmeter
- netflix oss
- RabbitMQ
- Airflow
- spring boot
- cassandra
- coalesce
- JPA
- KAFKA
- mybatis
Archives
- Today
- Total
IT.FARMER
2. 이제 실제 서플릿 파일이라든지 JSP 그리구, xml설정을 해줄거야 본문
반응형
지금까지는 사용하기 위해서 셋팅 한거구 이제 실제 서플릿 파일이라든지 JSP 그리구, xml설정을 해줄거야
<액션담당 서블릿 파일>
HelloWorld.java
package action;
import com.opensymphony.xwork2.Action;
public class HelloWorld implements Action {
private String message;
public String getMessage() {
return message;
}
public String execute() throws Exception {
message = "Hello, World!";
return SUCCESS;
import com.opensymphony.xwork2.Action;
public class HelloWorld implements Action {
private String message;
public String getMessage() {
return message;
}
public String execute() throws Exception {
message = "Hello, World!";
return SUCCESS;
}
}
<뷰담당 JSP 파일>
helloWorld.jsp
<html>
<head>
<title>Hello World</title>
</head>
<body>
message : <h2>${message}</h2>
</body>
</html>
<head>
<title>Hello World</title>
</head>
<body>
message : <h2>${message}</h2>
</body>
</html>
<struts 매핑 설정>
struts.xml
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="helloWorld" class="action.HelloWorld">
<result name="success">/view/helloWorld.jsp</result>
</action>
</package>
</struts>
<package name="default" extends="struts-default">
<action name="helloWorld" class="action.HelloWorld">
<result name="success">/view/helloWorld.jsp</result>
</action>
</package>
</struts>
<web.xml 설정>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.c/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>StrutsTest</display-name>
<welcome-file-list>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.c/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>StrutsTest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
반응형
'JAVA' 카테고리의 다른 글
JAVA Super Class , Overriding (0) | 2010.09.08 |
---|---|
파일 입출력 (0) | 2010.08.23 |
(기타)톰켓 + 다이니믹 웹 (0) | 2010.08.23 |
1. naver API 및 Struts (0) | 2010.08.23 |
java toString (0) | 2010.05.12 |