PDA

View Full Version : laszlo and struts


purplehaze
03-29-2004, 10:57 PM
Can Laszlo and struts be used together?

chrisk
03-31-2004, 12:01 PM
Struts is well suited to support both HTML based applications and Laszlo based applications at the same time. There are many approaches you can take. One approach would be to write new JSP’s, which simply generate XML instead of HTML. You would then need to create new action mappings in struts-config.xml, which would forward to the XML generating JSP. This is a great approach to get started quickly as you can reuse your existing Actions you already wrote to generate html, but you will only have access to the data already generated by those actions.

Because Laszlo applications are really good at showing a lot more data in a useful manner than traditional HTML pages, you might find that your existing Actions don't provide you with what you need. In this case, you can simply create new Actions which would generate the needed data, and then forward to
the JSP which formats the data in XML. As in the above example, you would add additional entries into struts-config.xml for the new request.

You will likely find that a combination of the two above approaches will suit your needs the best.

IBM has an article detailing a Web Services architecture with Struts at:

http://www-106.ibm.com/developerworks/webservices/library/ws-arcstruts/