2016-01-21 94 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是無稽之談。 –

相關問題