我看过很多教程,我读过很多关于如何在Apache Tomcat中使用REST的文章,但我仍然无法使其工作。我在写一些重要的东西。 所以我有基于DWR构建的Web服务器应用程序。我的应用程序的单个网页基于DWR java文件,允许javascript和服务器之间的通信。我需要实现REST子页面,它将基于REST。 我一般我的问题是我有现有的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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" version="2.4">
<!--
Context parameters.
-->
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.styleClass</param-name>
<param-value>rowHeaderLink</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.imageAlign</param-name>
<param-value>top</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.upImage.src</param-name>
<param-value>images/icon_arrow_up.png</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.upImage.width</param-name>
<param-value>16</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.upImage.height</param-name>
<param-value>16</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.upImage.altKey</param-name>
<param-value>pagination.ascending</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.downImage.src</param-name>
<param-value>images/icon_arrow_down.png</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.downImage.width</param-name>
<param-value>16</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.downImage.height</param-name>
<param-value>16</param-value>
</context-param>
<context-param>
<param-name>com.serotonin.web.taglib.ListSortTag.downImage.altKey</param-name>
<param-value>pagination.descending</param-value>
</context-param>
<!--
Filter definitions.
-->
<filter>
<filter-name>CharacterSet</filter-name>
<filter-class>com.serotonin.web.filter.CharacterSetFilter</filter-class>
<init-param>
<param-name>charset</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter>
<filter-name>IsLoggedIn</filter-name>
<filter-class>com.serotonin.mango.web.filter.NormalLoggedInFilter</filter-class>
<init-param>
<param-name>forwardUrl</param-name>
<param-value>/login.htm</param-value>
</init-param>
</filter>
<filter>
<filter-name>WebContext</filter-name>
<filter-class>com.serotonin.mango.web.filter.WebContextFilter</filter-class>
</filter>
<filter>
<filter-name>CacheHeaders</filter-name>
<filter-class>com.serotonin.mango.web.filter.HttpResponseHeaderFilter</filter-class>
<init-param>
<param-name>Cache-Control</param-name>
<param-value>max-age=5184000</param-value>
</init-param>
</filter>
<!--
Filter mappings.
-->
<filter-mapping>
<filter-name>CharacterSet</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CharacterSet</filter-name>
<url-pattern>*.shtm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>IsLoggedIn</filter-name>
<url-pattern>*.shtm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WebContext</filter-name>
<url-pattern>*.shtm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/interfaces/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/engine.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/utils.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/audio/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/images/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/graphics/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/resources/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>HttpResponseHeaderFilter</filter-name>
<filter-class> com.serotonin.mango.web.filter.HttpResponseHeaderFilter</filter-class>
<init-param>
<param-name>Cache-Control</param-name>
<param-value>max-age=5184000</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HttpResponseHeaderFilter</filter-name>
<url-pattern>/resources/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>HttpResponseHeaderFilter</filter-name>
<url-pattern>/images/*</url-pattern>
</filter-mapping>
<!--
Servlet definitions.
-->
<servlet>
<display-name>CXFNonSpringJaxrsServlet</display-name>
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>service.DataPointRestService</param-value>
</init-param>
<init-param>
<param-name>jaxrs.address</param-name>
<param-value>/rest</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>springDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>publishContainerAs</param-name>
<param-value>DwrContainer</param-value>
</init-param>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>imageChart</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ImageChartServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>asyncImageChart</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.AsyncImageChartServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>reportExport</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ReportExportServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>reportEventExport</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ReportEventExportServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>reportUserCommentExport</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ReportUserCommentExportServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>reportChart</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ReportChartServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>httpDataSource</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.HttpDataSourceServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>imageValue</servlet-name>
<servlet-class>com.serotonin.mango.web.servlet.ImageValueServlet</servlet-class>
</servlet>
<!--
Servlet mappings.
-->
<servlet-mapping>
<servlet-name>springDispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>springDispatcher</servlet-name>
<url-pattern>*.shtm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>imageChart</servlet-name>
<url-pattern>/chart/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>asyncImageChart</servlet-name>
<url-pattern>/achart/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>reportChart</servlet-name>
<url-pattern>/reportImageChart/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>reportExport</servlet-name>
<url-pattern>/export/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>reportEventExport</servlet-name>
<url-pattern>/eventExport/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>reportUserCommentExport</servlet-name>
<url-pattern>/userCommentExport/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>httpDataSource</servlet-name>
<url-pattern>/httpds</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>imageValue</servlet-name>
<url-pattern>/imageValue/*</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/resources/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/images/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/interfaces/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/engine.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheHeaders</filter-name>
<url-pattern>/dwr/utils.js</url-pattern>
</filter-mapping>
<!--
Context listeners.
-->
<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
<listener><listener-class>com.serotonin.mango.MangoContextListener</listener-class></listener>
<!--
Other stuff.
-->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>com.serotonin.mango.vo.permission.PermissionException</exception-type>
<location>/exception/accessDenied.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/exception/error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/exception/404.jsp</location>
</error-page>
<servlet>
<servlet-name>JavascriptServlet</servlet-name>
<servlet-class>net.jawr.web.servlet.JawrServlet</servlet-class>
<!-- Location in classpath of the config file -->
<init-param>
<param-name>configLocation</param-name>
<param-value>/jawr.properties</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>/jsBundle/</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JavascriptServlet</servlet-name>
<url-pattern>/jsBundle/*</url-pattern>
</servlet-mapping>
</web-app>
我已经创建了类和服务,它们在我的项目中成功构建(使用JSON-RI,Apache CFX):
package com.serotonin.service;
import java.net.URI;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import com.serotonin.domain.DataPoint;
import com.serotonin.domain.DataPointLists;
import com.serotonin.domain.DataPointManager;
/**
* The jax-rs service, deployable to Apache, which tracks data points.
*
* @author
*
*/
@Path("/datapoint")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public class DataPointRestService {
@Context
private UriInfo uriInfo;
/**
* Create a data point and add it to the data point manager.
*
* @param dataPoint the data point to create
* @return the status and url of the data point
* @throws Exception
*/
@POST
public Response create(DataPoint dataPoint) throws Exception {
if (dataPoint == null)
throw new Exception();
DataPointManager.add(dataPoint);
URI uri = uriInfo.getAbsolutePathBuilder()
.path(dataPoint.getName())
.build();
return Response.created(uri)
.build();
}
/**
* Update a food with new information.
*
* @param dataPoint the data point to update.
* @return status code
* @throws Exception
*/
@PUT
public Response update(DataPoint dataPoint) throws Exception {
if (dataPoint == null)
throw new Exception();
DataPointManager.delete(dataPoint.getName());
DataPointManager.add(dataPoint);
return Response.ok()
.build();
}
/**
* Get a data point.
*
* @param name the data point to get.
* @return the status and data point.
* @throws Exception
*/
@GET
@Path("{name}")
public Response get(@PathParam("name") String name) throws Exception {
DataPoint dataPoint = DataPointManager.find(name);
if (dataPoint == null)
throw new Exception();
return Response.ok(dataPoint)
.build();
}
/**
* Get all data points in the data point manager.
*
* @return xml or json of all data points
*/
@GET
public Response getAll() {
DataPointLists dataPointLists = DataPointManager.getListsOfPoints();
GenericEntity<List<DataPoint>> list = new GenericEntity<List<DataPoint>>(dataPointLists) {
};
return Response.ok(list)
.build();
}
/**
* Delete a data point.
*
* @param name data point to delete
* @return status of the operation
* @throws Exception
*/
@DELETE
@Path("{name}")
public Response delete(@PathParam("name") String name) {
DataPoint dataPoint = DataPointManager.find(name);
if (dataPoint == null)
DataPointManager.delete(name);
return Response.noContent()
.build();
}
}
然后:
package com.serotonin.domain;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Data holder for data points in list-of-data-points.shtm
* @author beata
* Sample data point :
* masterPointer":false,"dataSourceId":7,"settable":false,"xid":"pd","typeKey":"event.audit.dataPoint","name":"pd","id":5573,"folderId":9999,"enabled":true
*/
@XmlRootElement
public class DataPoint {
boolean masterPointer;
int dataSourceId;
boolean settable;
String xid;
String typeKey;
String name;
int id;
int folderId;
boolean enabled;
/**
* Constructor
*/
public DataPoint() {
super();
// TODO Auto-generated constructor stub
}
/**
* Constructor
*
* @param name
* @param xid
* @param id
* @param enabled
* @param settable
* @param folderId
* @param masterPointer
* @param dataSourceId
* @param typeKey
*/
public DataPoint(String name, String xid, int id, boolean enabled, boolean settable, int folderId,
boolean masterPointer, int dataSourceId, String typeKey) {
super();
this.name = name;
this.xid = xid;
this.id = id;
this.enabled = enabled;
this.settable = settable;
this.folderId = folderId;
this.masterPointer = masterPointer;
this.dataSourceId = dataSourceId;
this.typeKey = typeKey;
}
public DataPoint(String string, boolean b, String string2, int i, String string3, boolean c, String string4,
String string5, String string6, String string7, String string8, String string9, String string10, int j,
String string11, int k, String string12, boolean d) {
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "DataPoint [name=" + name + ", xid=" + xid + ", id=" + id + ", enabled=" + enabled + ", settable="
+ settable + ", folderId=" + folderId + ", masterPointer=" + masterPointer + ", dataSourceId="
+ dataSourceId + ", typeKey=" + typeKey + "]";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getXid() {
return xid;
}
public void setXid(String xid) {
this.xid = xid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isSettable() {
return settable;
}
public void setSettable(boolean settable) {
this.settable = settable;
}
public int getFolderId() {
return folderId;
}
public void setFolderId(int folderId) {
this.folderId = folderId;
}
public boolean isMasterPointer() {
return masterPointer;
}
public void setMasterPointer(boolean masterPointer) {
this.masterPointer = masterPointer;
}
public int getDataSourceId() {
return dataSourceId;
}
public void setDataSourceId(int dataSourceId) {
this.dataSourceId = dataSourceId;
}
public String getTypeKey() {
return typeKey;
}
public void setTypeKey(String typeKey) {
this.typeKey = typeKey;
}
}
下一步:
package com.serotonin.domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
*
* @author beata
*
*/
@XmlRootElement
@XmlSeeAlso(DataPoint.class)
public class DataPointLists extends ArrayList<DataPoint> {
private static final long serialVersionUID = 1L;
/**
* Constructor
*/
public DataPointLists() {
super();
}
/**
* Constructor
*
* @param c
* collection of initial data points .
*/
public DataPointLists(Collection<? extends DataPoint> c) {
super(c);
}
/**
* Get list of points.
*
* @return data points list
*/
@XmlElement(name = "list-of-points")
public List<DataPoint> getDataPointLists() {
return this;
}
/**
* Add a list of data points.
*
* @param dataPoints
* list to add
*/
public void addFoods(List<DataPoint> dataPoints) {
this.addAll(dataPoints);
}
}
package com.serotonin.domain;
import java.util.Optional;
/**
* Manages CRUD operations for data points.
*
* @author
*
*/
public class DataPointManager {
private static DataPointLists list = new DataPointLists();
static { // initialize with some data
// TODO: DATABASE REQUEST AND CONSTRUCTION OF POINT LISTS
//
// TEMPORARY TO HAVE SOMETHING TO READ
list.add(new DataPoint("masterPointer",false, "dataSourceId",7,"settable",false,"xid","pd","typeKey",
"event.audit.dataPoint","name","pd","id",5573,"folderId",9999,"enabled",true));
list.add(new DataPoint("masterPointer",false,"dataSourceId",9,"settable",false,"xid","DP_007365","typeKey",
"event.audit.dataPoint","name","A_OutForceN3","id",10526,"folderId",9999,"enabled",true));
list.add(new DataPoint("masterPointer",false,"dataSourceId",9,"settable",false,"xid","DP_079182",
"typeKey","event.audit.dataPoint","name","A_InEmulN3","id",10520,"folderId",9999,"enabled",true));
list.add(new DataPoint("masterPointer",false,"dataSourceId",9,"settable",false,"xid","DP_112452","typeKey",
"event.audit.dataPoint","name","ANALOGTEST13","id",10541,"folderId",9999,"enabled",true));
}
/**
* Get all existing data points.
*
* @return data point list
*/
public static DataPointLists getListsOfPoints() {
return list;
}
/**
* Find a data point in the list of data points.
*
* @param name
* data point to find
* @return food or null
*/
public static DataPoint find(String name) {
final Optional<DataPoint> foundDataPoint = list.stream()
.filter(dp -> dp.getName()
.equalsIgnoreCase(name))
.findFirst();
return foundDataPoint.orElse(null);
}
/**
* Add a data point to the list of data points.
*
* @param dataPoint
* data point to add
*/
public static void add(DataPoint dataPoint) {
list.add(dataPoint);
}
/**
* Delete a data point from the list of points.
*
* @param name
* data point to delete
*/
public static void delete(String name) {
DataPoint dataPoint = find(name);
list.remove(dataPoint);
}
}
需要在帖子顶部与此合并的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>DataPointRestServiceApache</display-name>
<servlet>
<display-name>CXFNonSpringJaxrsServlet</display-name>
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>service.DataPointRestService</param-value>
</init-param>
<init-param>
<param-name>jaxrs.address</param-name>
<param-value>/rest</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CXFNonSpringJaxrsServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
A还在我的应用程序中提交了AppplicationContext.xml和SpringDispatcher文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- DWR -->
<bean id="DataPointDetailsDwr" class="com.serotonin.mango.web.dwr.DataPointDetailsDwr" />
<bean id="DataPointEditDwr" class="com.serotonin.mango.web.dwr.DataPointEditDwr" />
<bean id="SystemSettingsDwr" class="com.serotonin.mango.web.dwr.SystemSettingsDwr" />
<bean id="UsersDwr" class="com.serotonin.mango.web.dwr.UsersDwr" />
<bean id="ViewDwr" class="com.serotonin.mango.web.dwr.ViewDwr" />
<bean id="WatchListDwr" class="com.serotonin.mango.web.dwr.WatchListDwr" />
</beans>
SpringDispatcher + servlet.xml中
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- - Application context definition for DispatcherServlet. -->
<beans>
<!-- URL mappings to controllers -->
<bean id="publicUrlMappings"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/sql.shtm">sqlController</prop>
<prop key="/system_settings.shtm">systemSettingsController</prop>
<prop key="/users.shtm">usersController</prop>
<prop key="/watch_list.shtm">watchListController</prop>
<prop key="/webcam_live_feed.htm">webcamLiveFeedController</prop>
<prop key="/list-of-points.shtm">listOfPointsController</prop>
</props>
</property>
<property name="interceptors">
<list>
<ref bean="commonData" />
</list>
</property>
</bean>
<bean id="loginController" class="com.serotonin.mango.web.mvc.controller.LoginController">
<property name="commandName">
<value>login</value>
</property>
<property name="commandClass">
<value>com.serotonin.mango.web.mvc.form.LoginForm</value>
</property>
<property name="formView">
<value>login</value>
</property>
<property name="successUrl">
<value>watch_list.shtm</value>
</property>
<property name="newUserUrl">
<value>help.shtm</value>
</property>
<property name="bindOnNewForm">
<value>true</value>
</property>
</bean>
<bean id="logoutController" class="com.serotonin.mango.web.mvc.controller.LogoutController">
<property name="redirectUrl">
<value>login.htm</value>
</property>
</bean>
<bean id="sqlController" class="com.serotonin.mango.web.mvc.controller.SqlController">
<property name="commandName">
<value>form</value>
</property>
<property name="commandClass">
<value>com.serotonin.mango.web.mvc.form.SqlForm</value>
</property>
<property name="formView">
<value>sql</value>
</property>
</bean>
<bean id="listOfPointsController"
class="com.serotonin.mango.web.mvc.controller.ListOfPointsController">
<property name="viewName">
<value>listOfpoints</value>
</property>
</bean>
我的问题是如何合并web.xml?我的方法是正确的,如果是正确的吗?也许我可以用不同的方法做到这一点。