Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
绝对uri:http://java.sun.com/jsp/jstl/core 无法解决_Java_Tomcat_Spring Mvc_Jstl - Fatal编程技术网

绝对uri:http://java.sun.com/jsp/jstl/core 无法解决

绝对uri:http://java.sun.com/jsp/jstl/core 无法解决,java,tomcat,spring-mvc,jstl,Java,Tomcat,Spring Mvc,Jstl,我拿起一个新创建的maven webapp项目,想用它来做最简单的mvc应用程序。我的环境看起来是这样的: <artifactId>spring-core</artifactId> <artifactId>spring-test</artifactId> <artifactId>spring-beans</artifactId> <artifactId>spring

我拿起一个新创建的maven webapp项目,想用它来做最简单的mvc应用程序。我的环境看起来是这样的:

<artifactId>spring-core</artifactId>
        <artifactId>spring-test</artifactId>
        <artifactId>spring-beans</artifactId>
        <artifactId>spring-context</artifactId>
        <artifactId>spring-aop</artifactId>
        <artifactId>spring-context-support</artifactId>
        <artifactId>spring-tx</artifactId>
        <artifactId>spring-orm</artifactId>  
        <artifactId>spring-web</artifactId>
        <artifactId>spring-webmvc</artifactId>
        <artifactId>spring-asm</artifactId>
        <artifactId>log4j</artifactId>
        <artifactId>hibernate-core</artifactId>
        <artifactId>hibernate-cglib-repack</artifactId>
        <artifactId>hsqldb</artifactId>

        <!-- particular arears-->
         <dependency>
           <groupId>taglibs</groupId>
           <artifactId>standard</artifactId>
           <scope>provided</scope>
        </dependency>
        <dependency>
           <groupId>javax.servlet</groupId>
           <artifactId>servlet-api</artifactId>
           <scope>provided</scope>
        </dependency>
        <!-- -->

       <spring.version>3.0.5.RELEASE</spring.version>
       <hibernate.version>3.6.1.Final</hibernate.version>
       <hibernate-cglig-repack.version>2.1_3</hibernate-cglig-repack.version>
       <log4j.version>1.2.14</log4j.version>
       <javax-servlet-api.version>2.5</javax-servlet-api.version>
       <hsqldb.version>1.8.0.10</hsqldb.version>
       <mysql-connector.version>5.1.6</mysql-connector.version>
       <slf4j-log4j12.version>1.5.2</slf4j-log4j12.version>
       <slf4j-api.version>1.5.8</slf4j-api.version>
       <javaassist.version>3.7.ga</javaassist.version>
       <taglibs.version>1.1.2</taglibs.version>


        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
    <finalName>admin-webapp</finalName>
</build>
<profiles>
    <profile>
        <id>endorsed</id>
        <activation>
            <property>
                <name>sun.boot.class.path</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.0.2</version>
                    <configuration>
                        <!-- javaee6 contains upgrades of APIs contained within the JDK itself.
                             As such these need to be placed on the bootclasspath, rather than classpath of the
                             compiler.
                             If you don't make use of these new updated API, you can delete the profile.
                             On non-SUN jdk, you will need to create a similar profile for your jdk, with the similar property as sun.boot.class.path in Sun's JDK.-->
                        <compilerArguments>
                            <bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
                        </compilerArguments>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>javax</groupId>
                            <artifactId>javaee-endorsed-api</artifactId>
                            <version>6.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
    <tomcat.home>${env.CATALINA_HOME}</tomcat.home>
    <web.context>${project.artifactId}</web.context>
</properties>
我的看法是:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>JSP Page</title>
   </head>
   <body>
      <h1>Hello World!</h1>
   </body>
</html>

JSP页面
你好,世界!
我得到的错误是

org.apache.jasper.JasperException:绝对uri:无法在web.xml或与此应用程序一起部署的jar文件中解析

问题1:我想知道这是否是由于我使用的版本造成的,我想我已经阅读了一些关于tomcat中支持的版本以及使用的java ee版本的内容。不要从中找到解决问题的方法。我怎样才能解决这个问题


问题2:在出现此错误之前,我的代码是400,因为我没有正确地将其指向
views/home.jsp
,但我确实注意到,当我在netbeans中运行应用程序时,它会打开带有url的浏览器:而我希望admin webapp是我的war的名称。我认为这是一个问题,我想解决它

您需要JSTL实现:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

javax.servlet
jstl
1.2
或者,如果手动包含JSTL jar:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
</dependency>

javax.servlet
jstl
1.2
假如
  • 从下载JSTLAPI和JSTL实现
  • 添加此指令:

  • 将JAR文件粘贴到WEB-INF/lib文件夹中。这应该行得通。(It) 为我工作。)


  • Tomcat实际上根本没有附带JSTL。在我们的JSTL wiki页面上阅读更多内容:谢谢你的回答,对问题2有什么想法吗?这似乎让我感到有些紧张,Hanks jeff,问题已经解决了。这个问题对我来说也很重要。应用程序仍然从
    http://localhost:8080/
    而不是
    http://localhost:8080/nameofmywar/
    如何解决这个问题?thanksIt听起来这并不是你的应用程序的问题,而是你想在NetBeans中编辑运行配置。在NetBeans项目属性中的“运行”类别下,“上下文路径”设置是什么?听起来好像没有上下文路径,或者设置为根(/)。如果为空,则输入“admin webapp”。
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ page session="false" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
       <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <title>JSP Page</title>
       </head>
       <body>
          <h1>Hello World!</h1>
       </body>
    </html>
    
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>