2011-04-26 51 views
1

我使用弹簧2.5.6与MVC如何显示静态页面。新网站我的工作有静态页面,如主页,简单的登陆页等,与其他CRUD类型的网页一起。Spring MVC的

我有一个时间赫克得到两个一起工作,所以很明显,我做的事情非常错误的原因也不能那么难。

首先,我开始了与以下为例:

<bean name="/account-landing.html" class="com.account.web.AccountLandingController"> 
    <property name="commandClass" value="com.account.web.AccountLandingCommand"/> 
    <property name="formView" value="account-landing"/> 
    <property name="successView" value="account-landing"/> 
</bean> 

和其他几个人,并且工作得很好。

现在,我要介绍

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
    <property name="mapping"> 
    <props> 
     <prop key="/home.html">urlFilenameViewController</prop> 
     [snip] 
    </props> 
    </property> 
</bean> 

<bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/> 

静态页面,有一个视图解析器。我的应用程序中的所有页面都已转换为.jsp。

我已经看过的文件过去,但仍不能点击。

谢谢

+0

你确定你的HTMLS越来越正确解决?转换成在jsp后,你改变了你的servlet调度员拦截HTML和JSP?顺便说一句 - 你实际上不需要通过Spring Dispatcher Servlet路由静态内容。这是一个开销。你可以在这里粘贴你的servlet配置吗? – Nilesh 2011-04-26 14:33:08

回答

1

如果你想静态页面不映射。把它放在一个单独的文件夹中并访问它。毕竟这是一个Web应用程序

http://<ip>/appname/htmls/test.html