2016-01-21 97 views
2

未解析的源代码,我使用Tomcat 8和Struts 1.3.10Struts的JSP页面显示不正确,它显示在浏览器

当我执行我的应用程序

http://127.0.0.1:8080/appli/welcome.jsp

我在浏览器中有这个

<%@ taglib uri =“http://struts.apache.org/tags-tiles”prefix =“tiles”%> <%@ taglib uri =“http://struts.apache.org/tags-html-el”prefix =“ html“ %> <%@ taglib uri =”http://struts.apache.org/tags-bean-el“ prefix =”bean“%> <%@ taglib uri =”http://java.sun .com/jstl/core“ prefix =”c“%> <%@ taglib uri =”http://struts.apache.org/tags-logic-el“ prefix =”logic“%>”>“>

消息在控制台:

2016年1月21日15 :20:39 DEBUG ModuleUtils:171 - 获取路径的模块名称 /generic/authentification/Login.do 2016-01-21 15:20:39调试 ModuleUtils:196 - 找到模块名称:default 2016-01-21 15 :20:39调试 RequestProcessor:161 - 处理'GET'路径 '/ generic/authentification/Login'2016-01-21 15:20:39调试 TilesRequestProcessor:265 - uri =/WEB-INF/jsp/generic/tiles/template_blank.jsp doInclude = false 2016-01-21 15:25:12 DEBUG ApplicationFilter:59 - 请求的路径: '/accueil.jsp' - 方法:GET 2016-01-21 15:25 :12调试 ApplicationFilter:63 - 访问refusé2016-01-21 15:25:12调试 ModuleUtils:171 - 获取路径的模块名称 /generic/authentification/L ogin.do 2016-01-21 15:25:12调试 ModuleUtils:196 - 找到模块名称:default 2016-01-21 15:25:12调试 RequestProcessor:161 - 处理路径'GET' '/通用/认证/登录2016年1月21日15时25分12秒DEBUG TilesRequestProcessor:265 - URI =/WEB-INF/JSP /通用/瓷砖/ template_blank.jsp doInclude =假

什么是错的?我忘了配置 有些事情?

我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<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.project</groupId> 
    <artifactId>appli</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>appli</name> 

    <dependencies> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-web-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Applicatif --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>5.0.7.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.struts</groupId> 
      <artifactId>struts-core</artifactId> 
      <version>1.3.10</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.struts</groupId> 
      <artifactId>struts-extras</artifactId> 
      <version>1.3.10</version> 
     </dependency> 

     <!-- JSP TLD --> 
     <dependency> 
      <groupId>net.fckeditor</groupId> 
      <artifactId>java-core</artifactId> 
      <version>2.6</version> 
     </dependency> 
     <!-- <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> 
      <version>1.1.2</version> </dependency> --> 
     <dependency> 
      <groupId>org.apache.struts</groupId> 
      <artifactId>struts-taglib</artifactId> 
      <version>1.3.10</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.struts</groupId> 
      <artifactId>struts-el</artifactId> 
      <version>1.3.10</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.struts</groupId> 
      <artifactId>struts-tiles</artifactId> 
      <version>1.3.10</version> 
     </dependency> 

     <!-- Birt --> 
     <dependency> 
      <groupId>org.eclipse.birt.runtime</groupId> 
      <artifactId>org.eclipse.birt.runtime</artifactId> 
      <version>4.3.0</version> 
      <exclusions> 
       <exclusion> 
        <artifactId>org.apache.poi</artifactId> 
        <groupId>org.eclipse.birt.runtime</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.9</version> 
     </dependency> 

     <!-- Divers --> 

     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 
     <dependency> 
      <groupId>com.novell.ldap</groupId> 
      <artifactId>jldap</artifactId> 
      <version>2009-10-07</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sf.json-lib</groupId> 
      <artifactId>json-lib</artifactId> 
      <version>2.4</version> 
      <classifier>jdk15</classifier> 
     </dependency> 
     <dependency> 
      <groupId>javax.mail</groupId> 
      <artifactId>javax.mail-api</artifactId> 
      <version>1.5.5</version> 
     </dependency> 

    </dependencies> 

    <build> 
     <finalName>apex</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
        <archive> 
         <manifestEntries> 
          <Specification-Title>J2EE Servlet</Specification-Title> 
          <Specification-Version>2.5</Specification-Version> 
          <Specification-Vendor>Sun Microsystems</Specification-Vendor> 
          <Implementation-Title>${pom.name}</Implementation-Title> 
          <Implementation-Version>${pom.version}</Implementation-Version> 
          <Implementation-Vendor>${pom.organization.name}</Implementation-Vendor> 
          <Built-By>me</Built-By> 
          <Implementation-URL>${pom.url}</Implementation-URL> 
         </manifestEntries> 
        </archive> 
        <compilerArguments> 
         <endorseddirs>${endorsed.dir}</endorseddirs> 
        </compilerArguments> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.3</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.6</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>7.0</version> 
            <type>jar</type> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

的welcome.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> 
<!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=ISO-8859-1"> 
<title>Login Example</title> 
</head> 
<body> 
    <html:form action="/login" focus="userName"> 
Username : <html:text property="userName" /> 
     <br> 
Password : <html:password property="password" /> 
     <br> 
     <html:submit value="login" /> 
    </html:form> 
</body> 
</html> 

网络。XML

当我评论两行所有的IT工作,但是当我取消这条线我有PB

<?xml version="1.0" encoding="ISO-8859-1"?> 

<web-app 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_2_5.xsd" version="2.5"> 
    <display-name>Struts Blank Application</display-name> 

    <!-- Standard Action Servlet Configuration --> 
    <servlet> 
     <servlet-name>action</servlet-name> 
     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> 
     <init-param> 
      <param-name>config</param-name> 
      <param-value>/WEB-INF/struts-config.xml</param-value> 
     </init-param> 
     <!-- <init-param> <param-name>chainConfig</param-name> <param-value>org/apache/struts/tiles/chain-config.xml</param-value> 
      </init-param> --> 
     <load-on-startup>2</load-on-startup> 
    </servlet> 


    <!-- Standard Action Servlet Mapping --> 
    <servlet-mapping> 
     <servlet-name>action</servlet-name> 
     <url-pattern>*.do</url-pattern> 
    </servlet-mapping> 
<!-- <servlet-mapping> --> 
<!--  <servlet-name>jsp</servlet-name> --> 
<!--  <url-pattern>/javascript/generic/messages.js</url-pattern> --> 
<!-- </servlet-mapping> --> 
<!-- <servlet-mapping> --> 
<!--  <servlet-name>jsp</servlet-name> --> 
<!--  <url-pattern>*.css</url-pattern> --> 
<!-- </servlet-mapping> --> 

    <!-- The Usual Welcome File List --> 
    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 

</web-app> 
+0

尝试后您的welcome.jsp – Abdelhak

+0

@Abdelhak我有我的后JSP – Mercer

+1

问题表明JSP引擎根本不运行。这反过来表明你已经在'web.xml'中以某种方式覆盖了它。例如,通过在'/ *'的URL模式上错误地映射不同的servlet。 – BalusC

回答

1

如果你在JSP页面中有未解析的代码意味着

JSP引擎根本没有运行

您已覆盖web.xml中的网页配置。因为你没有发布这个问题,所以我不能告诉你它错在哪里。可能是您错误地将action servlet映射到/*。这仅仅是标准配置

<!-- Standard Action Servlet Configuration --> 
    <servlet> 
    <servlet-name>action</servlet-name> 
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> 
    <init-param> 
     <param-name>config</param-name> 
     <param-value>/WEB-INF/struts-config.xml</param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
</servlet> 


    <!-- Standard Action Servlet Mapping --> 
    <servlet-mapping> 
    <servlet-name>action</servlet-name> 
    <url-pattern>*.do</url-pattern> 
    </servlet-mapping> 
+0

我添加了解释的web.xml – Mercer

+0

删除这些行。将js和css文件映射到jsp是无稽之谈。 –

相关问题