Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EPractice Lab review quiz 3 JSP/Servlet generates XML

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Question:
You wish to display product pages as PAD XML files on your website.
Select the Java EE component suitable for generating XML files.
a. JSP
b. servlet

Given answer : a


I think both JSP/Servlet can generate XML.
I found an example of using servlet to generate XML:
http://javahonk.com/dynamically-generate-xml-using-servlet/

I also found an example of using JSP to generate XML:
http://www.oracle.com/technetwork/articles/javase/webappdev2-140046.html
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Himai,

Both JSP and Servlet can generate XML, but it's about what is "suitable" to do it. Servlets is generally not suitable to generate HTML/XML content. Servlet is a java class and to generate HTML/XML from it is difficult and non-intuitive. JSP is more suitable because it's designed to generate HTML/XML. Syntax of JSP is like HTML/XML unlike Servlets where the syntax is Java...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic