• Post Reply Bookmark Topic Watch Topic
  • New Topic

EPractice Lab review quiz 3 JSP/Servlet generates XML

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • 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: 9597
36
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...
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!