SEO friendly URL’s in Java

May 19 2011 Published by under Java

If the application is open to all general Internet users, then it is almost mandatory to generate SEO friendly URLs, not just for e.g., the product URL but also the search results page in your application.


Using the RequestMapping annotation is one simple approach to generate seo friendly url:

For e.g.,
1.

@RequestMapping(method=RequestMethod.POST, value="/addAccount", headers="Accept=application/xml, application/json")

public @ResponseBody Account addAccount(@RequestBody Account account) {

}

The SEO friendly URL is – http://localhost:8080/myApp/addAccount

When you do a post to this url, the addAccount method is invoked.

2. For search

@RequestMapping(method=RequestMethod.GET, value="/search/{keyword}”)

public @ResponseBody SearchResults search(@PathVariable String keyword) {

}

No responses yet

Leave a Reply