My application is to generate HTML/WML pages having XML sheets. I am using XSLT stylesheets at the moment. Would JSP be better solution for this case?

swarraj kulkarni

There are pros and cons of using each technology. Let us assume that your data is available in XML format. In this scenario, if you wanted to support multiple user agents, like a web browser and a WAP-enabled phone for instance, you would have to develop different style sheets (XSL) for each user agent. Tomorrow, if you need to support some other user agent, like say a Palm PDA, you can add another style sheet using XSL and push the XML content to the device.

However, in case of JSP, you can author a single JSP page, since it can incorporate logic to serve multiple user agents dynamically.

The following is a summary of the differences between the contending appropaches:

  • It is difficult to incorporate substantial runtime intelligence with the XML/XSL approach.
  • XML/XSL presents a significant learning curve for developers. However, since most server-side developers understand servlets somewhat, moving to JSP is very easy.
  • XML/XSL transformation to generate WML is comparatively slower than JSP-based WML generation.
  • JSP/Servlet-based code management is easier than XML/XSL/Java/HTML-based code management.
  • JSP-based WML generation does not require third party tools, like an XSLT processor, XML Parser etc. It just requires a container which supports JSP.
  • You can easily incorporate other Java technologies in JSP like EJBs or other enterprise APIs.

So basically, if your WML code/services require more runtime intelligence and backend integration, think JSP. For simple WML generation, look at XML/XSL. This approach has also been mentioned in the bookProfessional WAP.