Hi everyone,
I'm new to Struts 2 (and Struts in general, for that matter). I've got the
Struts 2 framework up and running and I'm trying to figure out how to get it
to support a use case for our new application. We'd like to have a set of
web services that look like this:

http://www.domain.com/struts2/queryName.xml?param1=foo
http://www.domain.com/struts2/queryName.json?param1=foo
http://www.domain.com/struts2/queryName.html?param1=foo
http://www.domain.com/struts2/queryName.rss?param1=foo

As you can see, the query and its parameters won't change, but we'd like to
alter the result type based on the requested URL file type. How can I best
achieve this in Struts 2? I know that I can do some Apache rewriting to map
these to the correct Actions, but I'd much rather do it in the
struts-config.xml file if I can, that way I can just maintain everything
from one location.

Also, does anyone have any suggestions for best practices on how to handle
different result types? I'd like to reuse some of the same basic framework
pieces to handle all Rss, JSON, etc requests so that when I want to add a
new query to the web service, it's just a matter of adding another Action to
support it, and all of the result types are automatically inherited.

Thanks in advance for your help!
Kevin Conroy

Reply via email to