当前位置: 代码迷 >> Web前端 >> spring+struts2+dwr 五
  详细解决方案

spring+struts2+dwr 五

热度:612   发布时间:2013-01-07 10:02:24.0
spring+struts2+dwr 5
<%@page contentType="text/html; charset=UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="display" uri="display-tag"%>
<html>
<body>
<s:form action="/list.action" method="post">
<table style="border:none">
	<tr>
		<td><s:textfield id="staff.staffNo" label="Staff No" name="staff.staffNo"/></td>
		<td><s:textfield id="staff.staffName" label="Staff Name" name="staff.staffName"/></td>
		<td><s:textfield id="staff.status" label="Status" name="staff.status"/></td>
		<td><s:submit cssClass="button" label="Search"/></td>
	</tr>
</table>
</s:form>
  <display:table name="${staff}" id="table" pagesize="10" requestURI="/list.action" decorator="org.swj.site.util.Wrapper">
    <display:column property="staffNo" sortable="true"/>
    <display:column property="staffName"/>
    <display:column property="staffDepartment"/>
    <display:column property="status"/>
    <display:column property="link" title="operation"/>
  </display:table>
</body>
</html>


<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<s:form action="/upload.action" method="post" enctype="multipart/form-data">
	<table style="border:none">
		<tr>
			<td><s:textfield id="sheet" label="sheet number" name="sheet"/></td>
		</tr>
		<tr>
			<td><s:textfield id="row" label="row number" name="row"/></td>
		</tr>
		<tr>
			<td><s:textfield id="cell" label="cell number" name="cell"/></td>
		</tr>
		<tr>
			<td><s:file label="file" key="file"/></td>
		</tr>	
		<tr>
			<td><s:submit cssClass="button"/><s:reset cssClass="button"/></td>
		</tr>	
		
	</table>
</s:form>


<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>welcome</title>
</head>

<body>
<h2>欢迎使用本系统</h2>
<h3>抽奖规则</h3>
<h3>1.xxxxxxxxxx</h3>
<h3>2.xxxxxxxxxx</h3>
<h3>3.xxxxxxxxxx</h3>
</body>
</html>


<%@page contentType="text/html; charset=UTF-8" %>
	<table style="border:none">
		<tr>
			<td>
			<div id="luckyDog" style="position:relative">
				<div id="luckyDog-0" style="position:absolute;font: 100% arial;color:brown;margin: 0 20px"></div>
				<div id="luckyDog-1" style="position:absolute;font: 100% arial;color:red;margin: 0 40px"></div>
				<div id="luckyDog-2" style="position:absolute;font: 100% arial;color:orange;margin: 0 60px"></div>
				<div id="luckyDog-3" style="position:absolute;font: 100% arial;color:fuchsia;margin: 0 80px"></div>
				<div id="luckyDog-4" style="position:absolute;font: 100% arial;color:green;margin: 0 100px"></div>
				<div id="luckyDog-5" style="position:absolute;font: 100% arial;color:blue;margin: 0 120px"></div>
				<div id="luckyDog-6" style="position:absolute;font: 100% arial;color:purple;margin: 0 140px"></div>
				<div id="luckyDog-7" style="position:absolute;font: 100% arial;color:olive;margin: 0 160px"></div>
			</div>
			</td>
		</tr>
		<tr>
			<td height="50px">
				<input id="awardType" type="hidden" value="">
			</td>
		</tr>
		<tr>
			<td>一等奖:<input id="begin" type="button" value="开始" class="button" onclick="run();award(1);"><input id="end" type="button" value="停止" class="button" onclick="stop();"></td>
		</tr>
		<tr>
			<td>二等奖:<input id="begin" type="button" value="开始" class="button" onclick="run();award(2);"><input id="end" type="button" value="停止" class="button" onclick="stop();"></td>
		</tr>
		<tr>
			<td>三等奖:<input id="begin" type="button" value="开始" class="button" onclick="run();award(3);"><input id="end" type="button" value="停止" class="button" onclick="stop();"></td>
		</tr>

		<tr>
			<td><font color="red" size="6">一等奖获奖名单:</font></td>
		</tr>
		<tr>
			<td>
				<div id="award-1"></div>
			</td>
		</tr>

		<tr>
			<td height="50px">
				<br/>
			</td>
		</tr>
		
		<tr>
			<td><font color="blue" size="5">二等奖获奖名单:</font></td>
		</tr>
		<tr>
			<td>
				<div id="award-2"></div>
			</td>
		</tr>
		
		<tr>
			<td height="50px">
				<br/>
			</td>
		</tr>		
		
		<tr>
			<td><font color="green" size="4">三等奖获奖名单:</font></td>
		</tr>
		<tr>
			<td>
				<div id="award-3"></div>
			</td>
		</tr>
	</table>



#header
{
	background: #666 url("../images/sprites.gif") repeat-x 0 100%;
	margin: 0 0 25px;
	padding: 0 0 8px;
	width:90%;
	height:12%
}

#header #site-name
{
	font: 265% arial;
	letter-spacing: -.05em;
	margin:0 0 0 40px;
	padding:3px 0;
	color:#f0fcff;
	border:none
}

#footer
{
	background: transparent url("../images/sprites.gif") repeat-x 0 100%;
	margin: 0 0 10px;
	padding: 0 0 8px;
	width:90%;
	height:7%
}


#content-wrap
{
	position:relative;
	width:90%;
	height:75%
}

#utility 
{
	position:absolute;
	top:0;
	left:10px;
	width:15%;
	border-top:0px solid #999;
	padding-bottom:40px
}

#content 
{	
	margin: 0 15%
}

ul
{
	margin: .3em 0 1.5em 0;
	list-style-type:none
}

ul.related 
{
	margin-top: -1em
}

ol
{
	margin: .5em .5em 1.5em
}

ol li
{
	margin-left: 1.4em;
	padding-left: 0;
	background: none; 
	list-style-type: decimal
}

li
{
	line-height: 1.4em;
	padding-left: 25px;
	background: transparent url("../images/sprites.gif") no-repeat 0 0
}

li.doc
{
	background-position: 3px -500px
}

ul.nomarker li 
{
	background:none;padding-left:0
}

.button
{
	BORDER-RIGHT: #7b9ebd 1px solid; 
	PADDING-RIGHT: 2px; 
	BORDER-TOP: #7b9ebd 1px solid; 
	PADDING-LEFT: 2px; 
	FONT-SIZE: 12px; 
	FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde); 
	BORDER-LEFT: #7b9ebd 1px solid; 
	CURSOR: hand; 
	COLOR: black; 
	PADDING-TOP: 2px; 
	BORDER-BOTTOM: #7b9ebd 1px solid 
}


<?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.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>web-site</display-name>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/config/applicationContext-base.xml</param-value>
    </context-param>  
	
	<listener>  
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
	</listener>  
	
   	<filter>
       	<filter-name>sitemesh</filter-name>
       	<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
       	<init-param>
       		<param-name>configFile</param-name>
       		<param-value>/config/sitemesh.xml</param-value>
       	</init-param>
   	</filter>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
	 
	<filter>
		<filter-name>struts2</filter-name> 
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	
	<filter-mapping>
		<filter-name>struts2</filter-name> 
		<url-pattern>/*</url-pattern> 
	</filter-mapping>

	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
		<init-param>
			<param-name>targetFilterLifecycle</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>	

    <servlet>
    	<servlet-name>JspSupportServlet</servlet-name>
        <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>dwr-invoker</servlet-name>
        <!-- 
        <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
        -->
        <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
        <init-param>
        	<param-name>config</param-name>
        	<param-value>/config/dwr.xml</param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dwr-invoker</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>sitemesh-freemarker</servlet-name>
        <servlet-class>org.apache.struts2.sitemesh.FreemarkerDecoratorServlet</servlet-class>
        <init-param>
            <param-name>default_encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>sitemesh-freemarker</servlet-name>
        <url-pattern>*.ftl</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
    </listener>

	<jsp-config>
		<taglib>
			<taglib-uri>sitemesh-decorator</taglib-uri>
			<taglib-location>/tld/sitemesh-decorator.tld</taglib-location>
		</taglib>
	
		<taglib>
			<taglib-uri>sitemesh-page</taglib-uri>
			<taglib-location>/tld/sitemesh-page.tld</taglib-location>		
		</taglib>
		
		<taglib>
			<taglib-uri>display-tag</taglib-uri>
			<taglib-location>/tld/displaytag.tld</taglib-location>
		</taglib>
	</jsp-config>


	<error-page>
		<error-code>400</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>401</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>402</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>403</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>404</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>405</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>406</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>407</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>413</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>414</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>500</error-code>
		<location>/page/error/error.jsp</location>
	</error-page>

	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/page/error/errorException.jsp</location>
	</error-page>

	<welcome-file-list>
		<welcome-file></welcome-file>
	</welcome-file-list>
</web-app>



  相关解决方案