<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>
This is my current configuration for 404 errors.
What I want: When a person types www.host.com/word . I want the string "word" as input for my search url (which is www.host.com/search.do?keyword).
Does anyone know how to do this?
Map /
to your DispatcherServlet
(see section 16.2 of the Spring reference documentation) and set up a URI template as shown in section 16.3.2.1 . For example, you could set up a request mapping like so:
@RequestMapping(value="/{keyword}", method=RequestMethod.GET)
public ModelAndView doSearch(@PathVariable("keyword") String keyword)
{
// forward to your search page
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.