jsp:
<%@ page contentType="text/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@taglib prefix="x" uri="http://java.sun.com/jstl/xml"%>
<html>
<body>
<c:import url="/Sample/WEB-INF/books.xml" var="url" />
<x:parse xml="${url}" var="doc" />
<table border=1>
<th>
<tr>
<td>title</td>
<td>author</td>
</tr>
</th>
<x:forEach var="n" select="$doc/books/book">
<td>
<tr>
<x:out select="$n/title" />
</tr>
<tr>
<x:out select="$n/author" />
</tr>
</td>
</x:forEach>
</table>
</body>
</html>
books.xml:
<?xml version="1.0"?>
<books>
<book>
<title>cobol</title>
<author>roy</author>
</book>
</books>
After deployment, when i access my jsp page:
I got the error below:
Can anybody explain the problem mentioned below:
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.xmldemo1_jsp._jspService(xmldemo1_jsp.java:95)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Please help me to solve my problem.
Thanks,
Kiran