2016-08-15 9 views
0

바람둥이 7과 Java 6이있는 스프링 부트 프로젝트입니다. jasper.Jspc를 사용하여 jsp를 사전 컴파일하려하지만 생성 된 Java EL이 존재하지 않습니다. 평가.el은 jsp가 jspc 인 jspc가있는 jspc로 평가되고 있지 않습니다.

out.write ("스크립트 src = \"$ {pageContext.request.contextPath} /resources/js/AdvanceDeviceInfo.js \ "> \ r \ n");

이해야 뭔가 같은 :
out.write ((java.lang.String의) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate ("$ {pageContext.request.contextPath}"

그때 그 존재가 제대로 평가 개별하는 JSP에서 <%@ page isELIgnored="false" %>를 사용하는 경우

. 내가 가서 모든 JSP를 변경하지 않습니다 도와주세요.

개미 스크립트를 사전 컴파일

<target name="main"> 
    <echo message="base dir: ${project.basedir}"/> 
    <echo message="compile_classpath: ${compile_classpath}"/> 
    <mkdir dir="${target_dir}/java"/> 
    <mkdir dir="${target_dir}/resources"/> 
    <path id="jspc_classpath"> 
     <path path="${compile_classpath}"/> 
    </path> 
    <!-- <property environment="org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING" value="false"/> --> 
    <taskdef classname="org.apache.jasper.JspC" name="jasper" classpathref="jspc_classpath"/> 
    <copy todir="${project.basedir}/target/jsp"> 
     <fileset dir="${project.basedir}/src/main/webapp"> 
      <include name="**/templates/*.jsp"/> 
      <include name="**/views/**"/> 
      <exclude name="**/CVS/**"/> 
     </fileset> 
    </copy> 
    <copy todir="${project.build.outputDirectory}/public/resources"> 
     <fileset dir="${project.basedir}/src/main/webapp/resources"> 
      <include name="**/css/**"/> 
      <include name="**/img/**"/> 
      <include name="**/fonts/**"/> 
      <include name="**/js/**"/> 
      <include name="**/pie/**"/> 
      <exclude name="**/CVS/**"/> 
     </fileset> 
    </copy> 
    <jasper verbose="0" 
     uriroot="${project.basedir}/target/jsp" 
     webxml="${target_dir}/resources/jsp-web.xml" 
     trimSpaces="true" 
     outputDir="${target_dir}/java/" > 
    </jasper> 
    <copy todir="${project.build.outputDirectory}"> 
     <fileset dir="${target_dir}/resources"/> 
    </copy> 
    <javac srcdir="${target_dir}/java" 
     destdir="${project.build.outputDirectory}" 
     classpathref="jspc_classpath" 
     fork="true" 
     encoding="UTF-8" 
     includeantruntime="false"/> 
</target> 
에 대한
+0

안녕하세요 BalusC, 도와주세요. – user2862544

답변

0

몇 가지 해결책이 있습니다.
표시되는 이유는 web.xml 파일의 버전 때문일 가능성이 큽니다. web.xml 버전이 2.3이면 기본적으로 표현식이 평가되지 않습니다.

예를 들어, 당신은 당신의 web.xml 파일의 상단이있을 수 있습니다 것입니다 :

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 
    <web-app id="WebApp_ID"> 

그렇다면, 당신은이 최신 버전 (2.4, 2.5, 3.0)로 수정하고 표현 것이다 기본적으로 평가됩니다. 예를 들어, 위의 텍스트를

<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_3_0.xsd" 
    version="3.0"> 

으로 변경하면 표현식이 평가되기 시작합니다.

또는 web.xml 파일의 버전을 변경하는 대신 web.xml에 JSP 속성 그룹을 추가하여 scripting-invalid을 false로 설정할 수 있습니다.

<jsp-property-group> 
    <url-pattern>*.jsp</url-pattern> 
    <scripting-invalid>false</scripting-invalid> 
    </jsp-property-group> 
+0

감사합니다. 웹이 없습니다. 프로젝트에서 Xml 그래서 나는 이것을 할 수 없다. 기본적으로 스프링 부트 프로젝트입니다. 그것을 할 수있는 다른 방법이 있습니까? – user2862544