activeMQ
This commit is contained in:
@@ -1,7 +1,71 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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_3_0.xsd"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<display-name>ActiveMQSpringDemo</display-name>
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
||||
<!-- Log4J Start -->
|
||||
<context-param>
|
||||
<param-name>log4jConfigLocation</param-name>
|
||||
<param-value>classpath:log4j.properties</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>log4jRefreshInterval</param-name>
|
||||
<param-value>6000</param-value>
|
||||
</context-param>
|
||||
<!-- Spring Log4J config -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
||||
</listener>
|
||||
<!-- Log4J End -->
|
||||
|
||||
<!-- Spring 编码过滤器 start -->
|
||||
<filter>
|
||||
<filter-name>characterEncoding</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>characterEncoding</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<!-- Spring 编码过滤器 End -->
|
||||
|
||||
<!-- Spring Application Context Listener Start -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath*:applicationContext.xml,classpath*:ActiveMQ.xml</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<!-- Spring Application Context Listener End -->
|
||||
|
||||
|
||||
<!-- Spring MVC Config Start -->
|
||||
<servlet>
|
||||
<servlet-name>SpringMVC</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring-mvc.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>SpringMVC</servlet-name>
|
||||
<!-- Filter all resources -->
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<!-- Spring MVC Config End -->
|
||||
|
||||
</web-app>
|
||||
@@ -1,5 +1,104 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
System.out.println(path);
|
||||
String basePath = request.getScheme() + "://"
|
||||
+ request.getServerName() + ":" + request.getServerPort()
|
||||
+ path + "/";
|
||||
System.out.println(basePath);
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<base href="<%=basePath%>">
|
||||
|
||||
<title>ActiveMQ Demo程序</title>
|
||||
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="expires" content="0">
|
||||
<script type="text/javascript" src="resources/jquery-1.11.0.min.js"></script>
|
||||
<style type="text/css">
|
||||
.h1 {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#producer{
|
||||
width: 48%;
|
||||
border: 1px solid blue;
|
||||
height: 80%;
|
||||
align:center;
|
||||
margin:0 auto;
|
||||
}
|
||||
|
||||
body{
|
||||
text-align :center;
|
||||
}
|
||||
div {
|
||||
text-align :center;
|
||||
}
|
||||
textarea{
|
||||
width:80%;
|
||||
height:100px;
|
||||
border:1px solid gray;
|
||||
}
|
||||
button{
|
||||
background-color: rgb(62, 156, 66);
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
height:30px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
function send(controller){
|
||||
if($("#message").val()==""){
|
||||
$("#message").css("border","1px solid red");
|
||||
return;
|
||||
}else{
|
||||
$("#message").css("border","1px solid gray");
|
||||
}
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url:'<%=basePath%>activemq/'+controller,
|
||||
dataType:'text',
|
||||
data:{"message":$("#message").val()},
|
||||
success:function(data){
|
||||
if(data=="suc"){
|
||||
$("#status").html("<font color=green>发送成功</font>");
|
||||
setTimeout(clear,1000);
|
||||
}else{
|
||||
$("#status").html("<font color=red>"+data+"</font>");
|
||||
setTimeout(clear,5000);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
$("#status").html("<font color=red>ERROR:"+data["status"]+","+data["statusText"]+"</font>");
|
||||
setTimeout(clear,5000);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function clear(){
|
||||
$("#status").html("");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Hello World!</h2>
|
||||
<h1>Hello ActiveMQ</h1>
|
||||
<div id="producer">
|
||||
<h2>Producer</h2>
|
||||
<textarea id="message"></textarea>
|
||||
<br>
|
||||
<button onclick="send('queueSender')">发送Queue消息</button>
|
||||
<button onclick="send('topicSender')">发送Topic消息</button>
|
||||
<br>
|
||||
<span id="status"></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
4
src/main/webapp/resources/jquery-1.11.0.min.js
vendored
Normal file
4
src/main/webapp/resources/jquery-1.11.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user