Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Subclassing  RSS feed

 
Graham Mead
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I'm involved in a project which requires the production of HTML XML and WML from a JSP dependant on the client type. As the java code between the mark up languages will often be common we were thinking of introducing a Superclass between JSPBase or HTTPServlet and the 3 JSPs we will require for each type. This will allow each JSP to invoke inherited methods on the SuperClass rather than rewriting the same code. Is this the best way to do it? Also is a WAP JSP/Servlet on its way rather than going via a WAP gateway to translate to HTTP. TIA Graham
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I maybe wrong, but I will say it anyways....
From what I have read, this is precisely the type
of applications that use XSL/XSLT. Have the content
in XML format. Use an appropriate style-sheet depending
on the client. Convert the output of the transform to HTML,
by setting the appropriate processing instructions.
This way you have ONLY ONE place you have
to maintain your content, as opposed to three
places/sub-classes in the method you mentioned.
Again, you probably have your reasons why to want to go
one way or the other. My knowledge is theoritical, anyways.
Thanks for listening.
regds.
- satya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!