I was just wondering if there is any advantage to write JSP with XML syntax. Is it a editor friendly way of writing the JSP. Normal JSP editor such as Dreamweaver recognizes the conventional syntax very well. Do we need to use xml editor to write JSP.
I am sure there is some advantage towards writing JSP in XML because sun has included it in its specifications.
I'm not sure what mean by writing JSPs with XML syntax. If you just mean making the JSP follow the XML syntax rules to make it well-formed then the most obvious advantage would be that your JSP could be processed by any XML processing application. I'm sure there are others that someone else here knows....
The JSP Spec also gives the writer the option of writing their JSP page in XML syntax (a JSP Document). It too is then processed into an XML view, then into a Servlet and compiled into a .class
The advantages the spec lists for writing JSP Documents are (Servlet 2.3 spec section 5.1):
ok.... so the last one isn't really in the spec...
Also, check this thread for more info regarding JSP Documents and XML View.
[ May 06, 2002: Message edited by: Jessica Sant ]
Originally posted by Adam Hardy:
your point about using xslt to generate these JSP docs - sounds good but under what circumstances would you want to generate JSPs like that? (face showing lack of imagination)
Well -- all those reasons came right out of the JSP specification -- so I can't take credit for them. BUT (lets see how well my imagination works this early in the morning) -- I could see someone using an xslt generation to create a JSP doc in an MVC architecture.
You generate a single XML doc for a particular page, and then create different XSLT transformations dependent on the type of device that is connecting to the site (Mobile phone, PDA, Treo, IE, Netscape etc) and generate an individual JSP Document for each device.
.... think that's all I've got in me for the morning Sound plausible?
Originally posted by Rajul King:
Can you store all the building blocks of a jsp in the database and write a servlet to generate a jsp. when jsp goes to the browser, it converts it to the html page.
I think it can be done -- it would require a lot of processing though... and I can't quite think of the advantage of doing that.... I think the XSLT transformation would be a better choice in most cases.
[ May 09, 2002: Message edited by: Jessica Sant ]