0

I have trying to run this Spring example on a localhost Tomcat 7 installation. I am using cargo to depoy the war with the following coordinates:

<deployable>
    <groupId>demo</groupId>
    <artifactId>sleepless</artifactId>
    <type>war</type>
</deployable>

When I access the app from Tomcat manager, it brings me to:

http://localhost:8080/sleepless-1.0/home.html;jsessionid=DFBD9DB5B15416188D9E45A7FDC0D375

and that's very fine. When I click on a page link, it brings me to (for example):

http://localhost:8080/searchFlights.html

The /sleepless-1.0 part is missing and I get a 404. How can I make sure this spring example adds the missing part to all pages? What is the missing configuration?

Thanks.

4

1 に答える 1

1

リンクは次のように生成されます。

<a href="/searchFlights.html" title="Flights">

そのため、Webアプリのコンテキストパスを完全に無視します(セッションを追跡する手段としてのURL書き換えはサポートしていません)。JSTL<c:url>タグを使用する必要があります。

<a href="<c:url value='/searchFlights.html'/>" title="Flights">
于 2012-07-21T13:48:47.570 に答える