Learning JSP encountered problems---standard logo library

Source: Internet
Author: User
Tags tomcat
js| Standard | question

I just started to learn JSP, recently saw the standard logo library This section, the problem is really a lot of csdn on the issue of my question, incredibly only one person to reply. Dizzy.

Let's talk about these two questions now:

My environment is Eclipse 3.1 + jdk1.5 + tomcat 5

1.xmlbuddy_ 2.0.56 is always in the bag. In the unit and home, the same development environment (I guarantee exactly the same, I used the same installer), in the unit was suddenly successful.  It has been unsuccessful at home. Depressed. I thought it was xmlbuddy_2.0.56. The version is not correct, changed n or not.

2. After using the standard logo library, this problem always appears JSP parsing error:the Absolute Uri:http://java.sun.com/jsp/jstl/core cannot be resolved in either Web . xml or the jar files deployed with this application. Same two JSP files sometimes there's no such problem. Some websites of foreigners say this is Tomcat's Servlet-api.jar and ... Conflict (like this file), in fact I don't feel like it. Let me show you my two examples:

<! DOCTYPE HTML PUBLIC "-//w 3c//dtd HTML 4.0 transitional//en" >

<%@ page contenttype= "text/html; charset=gb2312 "Language=" Java%>

<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>
<jsp:usebean id = "cal" class= "Jstltest.calendarbean"/>

<title> Test Pages </title>
<body>

The time is currently:<br><br>
<c:out value = "${cal.date}"/>

<c:set var = "hour" value = "${cal.hour}" scope = "Request"/>

<c:choose>
<c:when test = "${hour >0 && hour <= One}" >
Good morning!
</c:when>

<c:when test = "${hour >=12 && Hour <=}" >
Good afternoon!
</c:when>

<c:otherwise>
Good evening!
</c:otherwise>

</c:choose>
</body>

There is no problem with this file. But look at the next one:

<! DOCTYPE HTML PUBLIC "-//w 3c//dtd HTML 4.0 transitional//en" >
<%@ page contenttype= "text/html; charset=gb2312 "Language=" Java%>

<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>
<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>

<fmt:setlocale value = "en_US"/>

<jsp:usebean id = "cal" class= "Jstltest.calendarbean"/>

<title> Test Pages </title>
<body>

The time is currently:<br><br>
<c:out value = "${cal.date}"/>

<c:set var = "hour" value = "${cal.hour}" scope = "Request"/>

<c:if test = "${hour >0 && hour <= One}" >
Good morning!
</c:if>

<c:if test = "${hour >=12 && Hour <=}" >
Good afternoon!
</c:if>

<c:if test = "${hour >=18}" >
Good evening!
</c:if>

<c:out value = "${hour}"/>
</body>
This page will appear with the above problem. JSP parsing error:the Absolute Uri:http://java.sun.com/jsp/jstl/core cannot is resolved in either Web.xml or the jar file S deployed with this application.

3. About the XML section of the logo library. The page code is as follows:

<%@ page contenttype= "text/html; charset=gb2312 "Language=" Java%>
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/xml" prefix= "x"%>

<c:import var= "RssFeed" url= "/jstltest/book.xml"/>
<x:parse var= "RSS" xml= "${rssfeed}"/>
<x:set select= "$book/book/title" var= "RSS" scope= "Session"/>
<b><x:out select= "$rss"/></b><br>

Error: The Content is isn't allowed in Prolog.

Javax.servlet.ServletException:javax.servlet.jsp.JspException:Content is isn't allowed in Prolog.
Org.apache.jasper.runtime.PageContextImpl.doHandlePageException (pagecontextimpl.java:844)
Org.apache.jasper.runtime.PageContextImpl.handlePageException (pagecontextimpl.java:781)
Org.apache.jsp.isjstlxml_jsp._jspservice (org.apache.jsp.isjstlxml_jsp:91)
Org.apache.jasper.runtime.HttpJspBase.service (httpjspbase.java:97)
Javax.servlet.http.HttpServlet.service (httpservlet.java:802)
Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:322)
Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:291)
Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:241)
Javax.servlet.http.HttpServlet.service (httpservlet.java:802)

Root cause

Org.xml.sax.SAXParseException:Content is isn't allowed in Prolog.
Com.sun.org.apache.xerces.internal.parsers.DOMParser.parse (Unknown Source)
Com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse (Unknown Source)
Org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource (parsesupport.java:227)
Org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter (parsesupport.java:193)
Org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter (parsesupport.java:199)
Org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter (parsesupport.java:206)
Org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag (parsesupport.java:138)
Org.apache.jsp.isjstlxml_jsp._jspx_meth_x_parse_0 (org.apache.jsp.isjstlxml_jsp:135)
Org.apache.jsp.isjstlxml_jsp._jspservice (org.apache.jsp.isjstlxml_jsp:74)
Org.apache.jasper.runtime.HttpJspBase.service (httpjspbase.java:97)
Javax.servlet.http.HttpServlet.service (httpservlet.java:802)
Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:322)
Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:291)
Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:241)
Javax.servlet.http.HttpServlet.service (httpservlet.java:802)

Dizzy.

Google also has few of these on it.

It's really depressing to learn alone.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.