Announcement Announcement Module
Collapse
No announcement yet.
Problems with SimpleUrlMapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with SimpleUrlMapping

    Hi,

    I've just put together my first Spring Web app and although it is all working fine I want to change some of the URLs. At the moment I am using "*.do" to represent actions and "*.htm" to represent static pages e.g.

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/cart.do">addToCart</prop>
    <prop key="/products.htm">products</prop>

    However, rather than using a URL like "/products.htm" for my products page I want to use the URL "/products/" as I would normally use if it were a true static page on Apache (obviously this would default to an index.html on the server but the user would not see the name of the page).

    Will Spring support using URLs in this way? Do I need to write a custom Handler?

    Thanks,

    Andy.

  • #2
    Yes it will.

    Have a look at BeanNameUrlHandlerMapping for a more convenient implementation BTW

    Anyways, you would change your mapping to "/products" or "/products/*".

    HTH.

    Comment

    Working...
    X