日期:2014-05-18  浏览次数:20678 次

新手学习mvc遇到的简单问题,请帮忙指教--在线等啊
1,model2hello.jsp

  <%@   page   contentType= "text/html;charset=GB2312 "   %>
<%@   taglib   prefix= "c "   uri= "http://java.sun.com/jsp/jstl/core "   %>

<html>
<head>
    <title> CH18   -   Model2Hello.jsp </title>
</head>
<body>

<h2> Model   2   范例   -   Hello   World </h2>

The   Message   is   :   <font   color= "red "> ${requestScope.message} </font>

</body>
</html>
======================================================
2,model2hello.java

import   java.io.*;
import   java.util.*;
import   javax.servlet.*;
import   javax.servlet.http.*;

public   class   Model2Hello   extends   HttpServlet   {

public   void   init(ServletConfig   config)   throws   ServletException   {
super.init(config);
}

public   void   service(HttpServletRequest   request,   HttpServletResponse   response)
throws   ServletException,   IOException   {

response.setContentType( "text/html ");
String   Message   =   "Hello   World ";
String   jsp   =   "/CH18/Model2Hello.jsp ";
request.setAttribute( "message ",   Message);

RequestDispatcher   rd   =   getServletContext().getRequestDispatcher(jsp);
rd.forward(request,   response);
}

public   void   destroy()   {
}
}
  运行时遇到问题:
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.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:411)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:118)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
org.apache.jasper.compiler.TagLibraryInfoImpl. <init> (TagLibraryInfoImpl.java:147)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Co