English 中文(简体)
我如何利用REST-ful URLs创建3 + Tiles 2网络应用程序?
原标题:How do I create a Spring 3 + Tiles 2 webapp using REST-ful URLs?

I m拥有一个时间分辨URLs和3. MVC的时间。 我刚刚建设一个热门世界,试图探索如何在春天建立知识、科学和技术丰富的网络应用,从理论上来说,这并不复杂。

我发现的所有例子都基于关注档案延期的配置(“*.htm”或“*.do”),包括人为的名录预设(“/foo”),或甚至以斜线(例如)固定道路,采用某种人为的舱面模式作为向决心者发出的信号。 若要采用教育、科学和技术方法,我就想避免一切uck忙,只使用我申请的自然URL模式。 我想(也许不正确)假设,在网络上,Xml I d 设置了“/*”的ur子,把所有东西都转给派遣Servlet供解决,然后才依靠我的控制器中的URL模式。

我可以可靠地拿出我的决心,赶上卢爱阵的模式,在我的所有审判中,这一结果造成一种资源没有发现错误,一种过度流入(流出)或某种不定期的3月3日“塞莱特约”痕迹,而我对春天的不满一般是,错误信息并不经常非常有用。

我想与蒂尔斯·2的决心者合作。 我把我的*jsp档案存放在WEB-INF/views中,并有一个单一线索引。 jjsp file at the application fundamental redirecting to the index file set by mypuout.xml (the Tiles 2 Configurer).

我是正常的春季3高级别组合:

<mvc:annotation-driven />

<mvc:view-controller path="/" view-name="index"/>

<context:component-scan base-package="com.acme.web.controller" />

......以乌尔尔基斯·Resolver、内部ResourceViewResolver、UrlFilenameViewController等各种组合和组合为基础,在我的Tiles 2组合档案中采用了各种变式。 接着,在我的控制员中,我试图走我的URL模式。 问题在于,我甚至能够可靠地找到决心,赶上向我的控制员发送的格局。

现在,这已经持续了数天,在我认为非常简单的执行问题上没有真正的进展。 我或许会试图一劳永逸地这样做,但我认为这应该是一个简单(几乎是缺省)的组合。 我只是试图制造一种简单的Hello World类应用,我不期望这是火箭科学。

没有人知道一个在线例子:显示一个简单的春季3 MVC + Tiles 2网络应用程序,使用REST-ful URLs(即避免诸如档案延期、增加目录或斜线等强迫URL模式),并且完全依靠春季3的代码/说明(即MVC本身之外的任何东西)来做到这一点?

非常感谢任何帮助。

问题回答
<bean id="tilesviewResolver" class="org.springframework.web.servlet.view.tiles2.TilesViewResolver" 
            p:order="0"/>

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles-defs/tilesConfig.xml</value>
            </list>
        </property>
</bean> 

The spring sample application : petcare has the linkages defined in a restful way. You can download these from : https://src.springframework.org/svn/spring-samples/ The steps are: 1. Define the tiles configuration bean (configuration xml file)

<!-- Initializes the Apache Tiles CompositeView system -->
    <beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <beans:property name="definitions">
            <beans:value>
                /WEB-INF/**/tiles.xml
            </beans:value>
        </beans:property>
        <beans:property name="checkRefresh" value="true" />
    </beans:bean>
  1. 界定在UrlBasedViewResolver中设置的品格

    value="org.springframework.web.servlet.view.tiles2.TilesView" />

  2. 界定每个布局/网页的物色定义文件。





相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签