1、错误描述

2014-7-13 17:20:50 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/FirstSSH] threw exception [/pages/student.jsp (line: 3, column: 0) /pages/pathTags.jsp (line: 1, column: 59) Attempt to redefine the prefix c to http://java.sun.com/jstl/core, when it was already defined as http://java.sun.com/jsp/jstl/core in the current scope.] with root cause
org.apache.jasper.JasperException: /pages/student.jsp (line: 3, column: 0) /pages/pathTags.jsp (line: 1, column: 59) Attempt to redefine the prefix c to http://java.sun.com/jstl/core, when it was already defined as http://java.sun.com/jsp/jstl/core in the current scope.
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
	at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:324)
	at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:357)
	at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:467)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

2、错误原因

     页面中引入:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="pathTags.jsp"%> 

pathTags.jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>  
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>  
<%@ taglib prefix="m" uri="http://java.sun.com/jsp/jstl/functions" %>  
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>  
  
<c:set var="bp" value="<%=basePath%>"></c:set>  
<c:set var="pa" value="<%=path%>"></c:set> 

   出现“<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> ”多次被引入到页面,出现重复


3、解决办法

     去掉页面中的“<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> ”