struts

RESTful Web Services for Java

After my recent work with Ruby, I've really started looking at creating RESTful web services in Java. I work with a client who has a lot of Struts applications, so my real area of interest is figuring out how to get Struts to provide RESTful interfaces. Here's what I've found so far (much of which doesn't relate to Struts):

Struts Redirect w/Parameters Part 2

In an earlier post, I described a class to handle redirects in Struts and passing parameters along. That technique is not necessary; as of Struts 1.2.7, you can use the ActionRedirect class instead.

Here's a basic example from inside the execute method in an Action.

Struts Redirect w/Parameters

If you have a Struts Action servlet and you want to redirect to another page, the standard Struts technique is to return an ActionForward and setup an appropriate forward entry in struts-config.xml:

return mapping.findForward("success");

Unfortunately, this doesn’t provide a mechanism for passing request parameters to the target. So what can you do if you want to redirect to another page and pass some parameters along? You use an additional class:

Syndicate content