group of test apps
Revisión | b3dc5f0fe725a361be478c42ec294e89678ff373 (tree) |
---|---|
Tiempo | 2014-01-29 12:01:08 |
Autor | astoria-d <astoria-d@mail...> |
Commiter | astoria-d |
hello-moto3 added
@@ -0,0 +1,30 @@ | ||
1 | +package motoSample; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | + | |
5 | +import javax.servlet.ServletException; | |
6 | +import javax.servlet.http.HttpServlet; | |
7 | +import javax.servlet.http.HttpServletRequest; | |
8 | +import javax.servlet.http.HttpServletResponse; | |
9 | + | |
10 | +public class HelloWorld extends HttpServlet { | |
11 | + private static final long serialVersionUID = 1L; | |
12 | + | |
13 | + public HelloWorld() { | |
14 | + super(); | |
15 | + } | |
16 | + | |
17 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) | |
18 | + throws ServletException, IOException { | |
19 | + request.getRequestDispatcher("/index.jsp").forward(request, response); | |
20 | + } | |
21 | + | |
22 | + protected void doPost(HttpServletRequest request, HttpServletResponse response) | |
23 | + throws ServletException, IOException { | |
24 | + request.setCharacterEncoding("UTF-8"); | |
25 | + String text = "Message: " + request.getParameter("message"); | |
26 | + request.setAttribute("text", text); | |
27 | + | |
28 | + request.getRequestDispatcher("/index.jsp").forward(request, response); | |
29 | + } | |
30 | +} |
@@ -0,0 +1,26 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> | |
3 | + <display-name>hello2</display-name> | |
4 | + <welcome-file-list> | |
5 | + <welcome-file>index.html</welcome-file> | |
6 | + <welcome-file>index.htm</welcome-file> | |
7 | + <welcome-file>index.jsp</welcome-file> | |
8 | + <welcome-file>default.html</welcome-file> | |
9 | + <welcome-file>default.htm</welcome-file> | |
10 | + <welcome-file>default.jsp</welcome-file> | |
11 | + </welcome-file-list> | |
12 | + | |
13 | + <servlet> | |
14 | + <description></description> | |
15 | + <display-name>HelloWorld</display-name> | |
16 | + <servlet-name>HelloWorld</servlet-name> | |
17 | + <servlet-class>motoSample.HelloWorld</servlet-class> | |
18 | + </servlet> | |
19 | + <servlet-mapping> | |
20 | + <servlet-name>HelloWorld</servlet-name> | |
21 | + <url-pattern>/HelloWorld</url-pattern> | |
22 | + </servlet-mapping> | |
23 | + <!-- | |
24 | + --> | |
25 | + | |
26 | +</web-app> | |
\ No newline at end of file |
@@ -0,0 +1,16 @@ | ||
1 | +@echo off | |
2 | +rem set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21 | |
3 | +set JAVA_HOME=C:\Users\dmotooka\AppData\jdk-7u45-windows-i586 | |
4 | + | |
5 | +rem set JBossHome=C:\Apps\JBoss\jboss-as-7.1.1.Final | |
6 | +set JBossHome=C:\Users\dmotooka\AppData\jboss-as-7.1.0.Final | |
7 | + | |
8 | +cd WEB-INF\classes | |
9 | +"%JAVA_HOME%\bin\javac" -classpath C:\Users\dmotooka\AppData\jboss-as-7.1.0.Final\modules\javax\servlet\api\main\jboss-servlet-api_3.0_spec-1.0.0.Final.jar motoSample\HelloWorld.java | |
10 | + | |
11 | +cd ..\.. | |
12 | + | |
13 | + | |
14 | +"%JAVA_HOME%\bin\jar.exe" -cvf hello-moto3.war *.jsp WEB-INF | |
15 | +copy hello-moto3.war "%JBossHome%\standalone\deployments | |
16 | +pause |
@@ -0,0 +1,28 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" | |
3 | + xmlns:fn="http://java.sun.com/jsp/jstl/functions" version="2.0"> | |
4 | + <jsp:directive.page language="java" | |
5 | + contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" /> | |
6 | + <jsp:text> | |
7 | + <![CDATA[ <?xml version="1.0" encoding="UTF-8" ?> ]]> | |
8 | + </jsp:text> | |
9 | + <jsp:text> | |
10 | + <![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ]]> | |
11 | + </jsp:text> | |
12 | +<html xmlns="http://www.w3.org/1999/xhtml"> | |
13 | +<head> | |
14 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
15 | +<title>Hello World</title> | |
16 | +</head> | |
17 | +<body> | |
18 | + <h1>Hello World</h1> | |
19 | + <form action="./HelloWorld" method="post"> | |
20 | + メッセージを入れてください<br /> | |
21 | + <input type="text" name="message"/> | |
22 | + <input type="submit" /> | |
23 | + </form> | |
24 | + <p>${fn:escapeXml(param.message)}</p> | |
25 | + <p>${fn:escapeXml(requestScope.text)}</p> | |
26 | +</body> | |
27 | +</html> | |
28 | +</jsp:root> | |
\ No newline at end of file |