Thread: JSTL problem
View Single Post
  #1 (permalink)  
Old June 13th, 2007, 01:45 AM
winsonkkp winsonkkp is offline
Registered User
 
Join Date: Jun 2007
Location: Sepang, Selangor, Malaysia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to winsonkkp
Default JSTL problem

Can somebody tell me what is the problem on this? Please......
Or if anyone have bought the Beginning JavaServer Pages book, please refer to page 41

The code in index.jsp file is like this:

<html>
<head>
<title>Select Your Portal</title>
</head>

<body>
<h1>Select your preferred portal:</h1>
<form action="showportal.jsp" method="get">
<select name="portchoice">
<option>news</option>
<option>weather</option>
<option>entertainment</option>
</select>
<input type="submit" value="Select"/></form>
</body>
</html>

The codes in showportal.jsp is like this:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<c:choose>
    <c:when test="${param.portchoice == 'news'}">
        <head><title>News Portal</title></head>
        <body>
        <h1>Headline News Just For You!</h1></body>
    </c:when>
    <c:when test="${param.portchoice == 'weather'}">
        <head><title>Weather Portal</title></head>
        <body>
        <h1>Accurate Weather Around the Clock!</h1></body>
    </c:when>
    <c:when test="${param.portchoice == 'entertainment'}">
        <head><title>Entertainment Portal</title></head>
        <body>
        <h1>The Most Popular Reality TV Shows!</h1></body>
    </c:when>
    <c:otherwise>
        <head><title>System Portal</title></head>
        <body>
        <h1>Application logic problem detected!</h1></body>
    </c:otherwise>
</html>

The error comes out are like this:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: 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
    org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.gene rateTLDLocation(TagLibraryInfoImpl.java:317)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<ini t>(TagLibraryInfoImpl.java:148)
    org.apache.jasper.compiler.Parser.parseTaglibDirec tive(Parser.java:424)
    org.apache.jasper.compiler.Parser.parseDirective(P arser.java:493)
    org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1557)
    org.apache.jasper.compiler.Parser.parse(Parser.jav a:127)
    org.apache.jasper.compiler.ParserController.doPars e(ParserController.java:212)
    org.apache.jasper.compiler.ParserController.parse( ParserController.java:101)
    org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:156)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:296)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:265)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:299)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:315)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

Hello
Reply With Quote