File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts Design decision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Design decision" Watch "Struts Design decision" New topic
Author

Struts Design decision

raj joe
Ranch Hand

Joined: Mar 17, 2005
Posts: 99
Requirement from the customer : Multiple Device Support provision in the presentation layer.They suggest the following approach using xml/xsl
Controller servlet > Action class > DAO
when an xml string is returned from the DAO,action class uses xml/xsl tranfomer to html.

1.Can struts still be used here and what features of struts and JSP will in loose out here.
2.Will there be .JSP pages in the approach as I see html is generated by the transformer
3.Can struts alone as the presnetaion layer framework ,still catering to multiple device support,without xml/xsl.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If I were starting a project that required support for multiple devices, I'd use JSF. JSF has good separation between the content being displayed and the way it's being displayed. By using different rendering kits, you can display the same control on two different devices. The only down side of JSF is that it's still a relatively new technology and you may not be able to find a rendering kit for the specific device you need to use. You may end up having to write some of this low level code yourself.

If your client has already made up their mind about using XML/XSL, then I guess there's not much you can do about it, but I'd really push for JSF if their minds are still open.

If you do go with XML/XSL, You can certainly handle the page navigation with Struts. You won't be able to use the Struts custom tags, though, or make much use of the ActionForm.


Merrill
Consultant, Sima Solutions
raj joe
Ranch Hand

Joined: Mar 17, 2005
Posts: 99
Originally posted by Merrill Higginson:
If I were starting a project that required support for multiple devices, I'd use JSF. JSF has good separation between the content being displayed and the way it's being displayed. By using different rendering kits, you can display the same control on two different devices. The only down side of JSF is that it's still a relatively new technology and you may not be able to find a rendering kit for the specific device you need to use. You may end up having to write some of this low level code yourself.

If your client has already made up their mind about using XML/XSL, then I guess there's not much you can do about it, but I'd really push for JSF if their minds are still open.

If you do go with XML/XSL, You can certainly handle the page navigation with Struts. You won't be able to use the Struts custom tags, though, or make much use of the ActionForm.


Merrill

My client is stuck XML/XSL.I just want to know how do I use both Jsp and XML\XSL.Can a jsp page with some static html content,JSTL tags,struts tags and XSL tags be displayed on a mobile device without any issues.

Is it better to have seperate jsp for diffrent devices/clients.

How do i handle pagination in the above case with XML/XSL and JSP?
[ June 05, 2006: Message edited by: raj joe ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Raj,

If you're going to use XML/XSL, your JSPs will likely consist of only a single <x:transform> tag to match up the XML content with the XSL template and render it.

As I mentioned before, if you use this approach, you won't be able to use Struts tags at all. Struts tags generate strictly HTML. Since you also want to generate WML (or who knows what else), you're not going to be able to do it with Struts tags.

In your XSL template, you can certaintly specify a struts Action as the action of a <form> tag. That action can call whatever back-end processes need to be called to generate the XML and can navigate to a JSP with the <x:transform> tag to render the output. Also, as long as you name your imputs appropriately, Struts can still populate an ActionForm for you. You'll get no help from Struts, though, when it comes to creating the XML or the XSL templates.

For each panel, you will want to have two different XSL templates: one for HTML and the other for WML. Since all the JSP does is match the XML with the XSL, you could use the same JSP and have it use either the HTML or WML templates depending on some varialbe indicating the type of output expected.

I'm really no expert on this, but I hope I've at least given you a few ideas. Good luck.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I recall back when the XML craze was fairly new (I guess this was the late 1990's) that this was how web application were going to be written. The server would return meaningful XML data back to the browser and the browser would apply a stylesheet to transform the XML into HTML. I can remember playing around with a few demos, but I recall that the XSLT support of the browsers of the day was pretty spotty and not consistent. This style of development never caught on.

I suppose that you could push the transformation onto the server so at least you would not be dependant on the brower's support. I also imagine that you could generate the XML, apply a transformation that would produce a JSP page and then get your servlet engine to execute the JSP file, but I would not know where to start with this approach.

I am mostly just rambling here because I do not have experience in this area. I would research other mobile solutions and see what others are using. It is hard for me to envision Struts fitting into the solution, but maybe.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Design decision
 
Similar Threads
about struts
display image from Action class?? Please help
JSP to PDF
JSP Vs (XML and XSL)
JSP + XSL + XML