Reputation: 1256
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.
Upvotes: 1
Views: 1094
Reputation: 1109362
JSP is just a Java based view technology, it is not a MVC framework, you can best compare JSP with "Classic ASP". The Java EE counterpart of ASP.NET-MVC is JSF (JavaServer Faces). I know JSF thoroughly, but I don't seem to recognize the part what you need. It seems more to be RESTFul-flavored. In that case, have a look to Spring 3.0 MVC. It provides "URI-template" annotations to listen on certain RESTFul requests. True, this is also not really what you're looking for, but it might give you some new insights and ideas.
Upvotes: 0
Reputation: 35951
Raw JSP doesn't provide such functionality. There a two choice:
Upvotes: 1