Not using JSP as the view
Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng
Re: Not using JSP as the view
The Struts Action returns an ActoinForward object. The path property of determines which resource gets control. The resource can be anything, not just a JSP or Struts Action. So if you had a servlet that rendered XML, you could forward to that instead. The Expresso framework has a standard option for using XML/XLS with Struts. The Stxx extension also looks quite good. http://jakarta.apache.org/struts/resources/views.html Depending on what you need to do, another technique is to use the digester to convert XML to a JavaBean (if the XML is someplace where the Action can get it), and then pass that down to the JSP. There are also tags for doing XML/XLS conversions within the JSP. http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html -Ted. Billy Ng wrote: Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng -- Ted Husted, Husted dot Com, Fairport NY US co-author, Java Web Development with Struts Order it today: http://husted.com/struts/book.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Not using JSP as the view
ic, I thought the ActionForward had to be jsp file. Thanks a lot! Billy Ng - Original Message - From: Ted Husted [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 04, 2002 2:25 PM Subject: Re: Not using JSP as the view The Struts Action returns an ActoinForward object. The path property of determines which resource gets control. The resource can be anything, not just a JSP or Struts Action. So if you had a servlet that rendered XML, you could forward to that instead. The Expresso framework has a standard option for using XML/XLS with Struts. The Stxx extension also looks quite good. http://jakarta.apache.org/struts/resources/views.html Depending on what you need to do, another technique is to use the digester to convert XML to a JavaBean (if the XML is someplace where the Action can get it), and then pass that down to the JSP. There are also tags for doing XML/XLS conversions within the JSP. http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html -Ted. Billy Ng wrote: Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng -- Ted Husted, Husted dot Com, Fairport NY US co-author, Java Web Development with Struts Order it today: http://husted.com/struts/book.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Not using JSP as the view
Ted Husted wrote: There are also tags for doing XML/XLS conversions within the JSP. http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html I suggest that folks use the JSP Standard Tag Library (JSTL) XML actions instead. I'm not familiar with the taglib cited above, but after a quick perusal of the website it looks as though the JSTL actions have the same functionality. And, of course, JSTL is a standard. david -Ted. Billy Ng wrote: Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not using JSP as the view
Another option is to output what you need (e.g. your XML) directly to the response, and then return 'null' from your Action to tell Struts that you have already handled the response, and Struts need do nothing. -- Martin Cooper -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 04, 2002 2:26 PM To: Struts Users Mailing List Subject: Re: Not using JSP as the view The Struts Action returns an ActoinForward object. The path property of determines which resource gets control. The resource can be anything, not just a JSP or Struts Action. So if you had a servlet that rendered XML, you could forward to that instead. The Expresso framework has a standard option for using XML/XLS with Struts. The Stxx extension also looks quite good. http://jakarta.apache.org/struts/resources/views.html Depending on what you need to do, another technique is to use the digester to convert XML to a JavaBean (if the XML is someplace where the Action can get it), and then pass that down to the JSP. There are also tags for doing XML/XLS conversions within the JSP. http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html -Ted. Billy Ng wrote: Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng -- Ted Husted, Husted dot Com, Fairport NY US co-author, Java Web Development with Struts Order it today: http://husted.com/struts/book.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]