jjzjj

java - 绝对 uri : http://java. sun.com/jsp/jSTL/core 无法在 web.xml 或随此应用程序部署的 jar 文件中解析

coder 2024-03-31 原文

我在 spring mvc 中遇到这个错误

我看到了类似的问题,但奇妙的是我在 WEB-INF 下没有任何 lib 文件夹!

我正在使用 jdk 1.7netbeans7 以及 maven

这是我的项目结构:

这是pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.sajjad</groupId>
    <artifactId>OnlineBookStore2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>OnlineBookStore2</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>org-apache-commons-logging</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>cglib-2.2</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-aop-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-aspects-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-beans-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-build-src-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-context-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-context-support-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-core-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-expression-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-framework-bom-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-instrument-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-instrument-tomcat-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-jdbc-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-jms-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-messaging-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-orm-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-oxm-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-test-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-tx-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-web-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-webmvc-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-webmvc-portlet-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>spring-websocket-4.0.1.RELEASE</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>hibernate-jpa-2.1-api-1.0.0.Final</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>6.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>unknown-jars-temp-repo</id>
            <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
            <url>file:${project.basedir}/lib</url>
        </repository>
    </repositories>
</project>

这是我的 web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

这是我的dispatcher-servlet.xml:

<?xml version='1.0' encoding='UTF-8' ?>
<beans xsi:schemaLocation="http://www.springframework.org/schema/beans
                          http://www.springframework.org/schema/beans/spring-beans.xsd
                          http://www.springframework.org/schema/context
                          http://www.springframework.org/schema/context/spring-context.xsd
                          http://www.springframework.org/schema/mvc
                          http://www.springframework.org/schema/mvc/spring-mvc.xsd"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"> 

    <context:component-scan base-package="sajjad.htlo"/> 
    <mvc:annotation-driven/>

    <mvc:resources mapping="/resources/**" location="/resources/pics/" />
    <mvc:default-servlet-handler/>

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="viewResolver">
        <property name="prefix"> 
            <value>/WEB-INF/jsp/</value> 
        </property> 
        <property name="suffix"> 
            <value>.jsp</value> 
        </property> 
    </bean>
</beans>

我的 Controller 类:

@Controller
public class IndexController {
    @RequestMapping(value = "/index.html")
    public ModelAndView indexPage() {
        return new ModelAndView("index");
    }
}

我的 View jsp文件:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Welcome</title>
    </head>
    <body>
        this is index page
        <img src="resources/pics/t3.jpg" />
    </body>
</html>

当我尝试:http://localhost:8080/OnlineBookStore2/index.html 发生此错误:

HTTP Status 500 - 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.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:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
...

我要从 jsp 文件访问图像。

更新

我在WEB-INF下创建了lib文件夹,并将jSTL-1.2.jar放在里面,如图所示:

但是我也遇到了同样的问题。

最佳答案

需要将jSTL标签库添加到WEB-INF/lib文件夹中。如果没有,请创建 lib 文件夹。

关于 jSTL 的更多信息 here

同时将它添加到你的 maven 依赖项中

关于java - 绝对 uri : http://java. sun.com/jsp/jSTL/core 无法在 web.xml 或随此应用程序部署的 jar 文件中解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28474448/

有关java - 绝对 uri : http://java. sun.com/jsp/jSTL/core 无法在 web.xml 或随此应用程序部署的 jar 文件中解析的更多相关文章

  1. Ruby 解析字符串 - 2

    我有一个字符串input="maybe(thisis|thatwas)some((nice|ugly)(day|night)|(strange(weather|time)))"Ruby中解析该字符串的最佳方法是什么?我的意思是脚本应该能够像这样构建句子:maybethisissomeuglynightmaybethatwassomenicenightmaybethiswassomestrangetime等等,你明白了......我应该一个字符一个字符地读取字符串并构建一个带有堆栈的状态机来存储括号值以供以后计算,还是有更好的方法?也许为此目的准备了一个开箱即用的库?

  2. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  3. ruby - 其他文件中的 Rake 任务 - 2

    我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时

  4. ruby-on-rails - 在 Rails 中将文件大小字符串转换为等效千字节 - 2

    我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,

  5. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  6. ruby-on-rails - Rails 3 中的多个路由文件 - 2

    Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题

  7. ruby - 将差异补丁应用于字符串/文件 - 2

    对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl

  8. ruby - 如何将脚本文件的末尾读取为数据文件(Perl 或任何其他语言) - 2

    我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚

  9. ruby - 解析 RDFa、微数据等的最佳方式是什么,使用统一的模式/词汇(例如 schema.org)存储和显示信息 - 2

    我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i

  10. ruby - 如何指定 Rack 处理程序 - 2

    Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack

随机推荐