Is there a Java equivalent for Ruby on Rails "url_for"?

Posted by Oren Ben-Kiki on Stack Overflow See other posts from Stack Overflow or by Oren Ben-Kiki
Published on 2010-02-22T20:00:03Z Indexed on 2010/06/16 5:02 UTC
Read the original article Hit count: 244

Filed under:
|
|

I have written something like this pretty easily in C# (string GetUrl(new { controller = "foo", action = "bar", baz = "fnord" }), based on the existing capabilities of the XmlRouteCollection class provided by the ASP.NET MVC framework (why it isn't there out of the box is beyond me; the additional required code was trivial). I am now faced with a JSP project, and I need the same ability: centralize the logic for generating all URLs in one place, based on a list of routing rules. Is there some code somewhere I could reuse/adapt to do this in Java? It seems like a common enough requirement, but google proved surprisingly unhelpful in finding something like this.

© Stack Overflow or respective owner

Related posts about java

Related posts about mvc