tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabien R <theedge...@free.fr>
Subject Re: jsp handling between catalina.sh and eclipse
Date Sun, 21 Aug 2016 09:53:49 GMT
On 19/08/16 19:22, Romain Manni-Bucau wrote:
> I would recommand you to build a sample on github with tomee-maven-plugin.
> Would help switching libs and sharing tests easily.
Yeah, I know. But I don't - need to - use maven. I'll dig into it when I 
have time...

Anyway, I tracked down the problem: the java code generated for my jsp 
is different on both environments.

The jsp test file:

<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
	<jsp:directive.page contentType="text/html; charset=UTF-8"
		pageEncoding="UTF-8" session="false" isELIgnored="false"
		/>
	<jsp:output doctype-root-element="html"
		doctype-system="html"
		omit-xml-declaration="true" />
<html xmlns:c="http://java.sun.com/jsp/jstl/core"
	>	
<head>
	<title>test</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="Content-Style-Type" content="text/html; charset=UTF-8" />
</head>
<body >
test = ${2 * 4 + 3 * 4}
<c:forEach var="pro" items="${POPULAR_PROPOSAL_LIST}">
  	<jsp:text>${pro.title}</jsp:text>
  </c:forEach>
</body>
</html>
</jsp:root>

The c:forEach is translated as a procedure on eclipse:
/*
  * Generated by the Jasper component of Apache Tomcat
  * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
  * Generated at: 2016-08-21 08:58:51 UTC
  * Note: The last modified time of this file was set to
  *       the last modified time of the source file after
  *       generation to assist with modification tracking.
  */
package org.apache.jsp.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
     implements org.apache.jasper.runtime.JspSourceDependent {

   private static final javax.servlet.jsp.JspFactory _jspxFactory =
           javax.servlet.jsp.JspFactory.getDefaultFactory();

   private static java.util.Map<java.lang.String,java.lang.Long> 
_jspx_dependants;

   private org.apache.jasper.runtime.TagHandlerPool 
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;

...

     if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
         return;

But not with catalina started by jsvc.exe:

/*
  * Generated by the Jasper component of Apache Tomcat
  * Version: Apache Tomcat (TomEE)/7.0.62 (1.7.2)
  * Generated at: 2016-08-21 09:13:02 UTC
  * Note: The last modified time of this file was set to
  *       the last modified time of the source file after
  *       generation to assist with modification tracking.
  */
package org.apache.jsp.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
     implements org.apache.jasper.runtime.JspSourceDependent {

   private static final javax.servlet.jsp.JspFactory _jspxFactory =
           javax.servlet.jsp.JspFactory.getDefaultFactory();

   private static java.util.Map<java.lang.String,java.lang.Long> 
_jspx_dependants;

   private javax.el.ExpressionFactory _el_expressionfactory;
   private org.apache.tomcat.InstanceManager _jsp_instancemanager;

...

       out.write("<c:forEach items=\"" + (java.lang.String) 
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${POPULAR_PROPOSAL_LIST}",

java.lang.String.class, 
(javax.servlet.jsp.PageContext)_jspx_page_context, null, true) + "\" 
var=\"pro\">");
       out.write((java.lang.String) 
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pro.title}", 
java.lang.String.class, 
(javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
       out.write("</c:forEach>");

Of course, I thought about forcing the compilation to JDT by changing 
the jsp servlet in the app web.xml:

   <servlet>
         <servlet-name>jsp</servlet-name>
 
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
         <init-param>
             <param-name>compiler</param-name>
 
<param-value>org.apache.jasper.compiler.JDTCompiler</param-value>
         </init-param>
         <init-param>
             <param-name>keepgenerated</param-name>
             <param-value>true</param-value>
         </init-param>
         <init-param>
             <param-name>scratchdir</param-name>
             <param-value>/tmp</param-value>
         </init-param>
         <init-param>
             <param-name>quoteAttributeEL</param-name>
             <param-value>false</param-value>
         </init-param>
          <init-param>
             <param-name>modificationTestInterval</param-name>
             <param-value>5</param-value>
         </init-param>
         <init-param>
             <param-name>compilerSourceVM</param-name>
             <param-value>1.7</param-value>
         </init-param>
         <init-param>
             <param-name>compilerTargetVM</param-name>
             <param-value>1.7</param-value>
         </init-param>
         <init-param>
             <param-name>fork</param-name>
             <param-value>false</param-value>
         </init-param>
         <init-param>
             <param-name>xpoweredBy</param-name>
             <param-value>false</param-value>
         </init-param>
         <init-param>
             <param-name>development</param-name>
             <param-value>true</param-value>
         </init-param>
         <load-on-startup>3</load-on-startup>
     </servlet>

But without success. The EL is active but the c:forEach is handled 
differently.

Any hints ?

--
Fabien

Note: without eclipse, tomEE is started by this command from an init.d 
script:
jsvc.exec -java-home /usr/lib/jvm/java-7-openjdk-amd64 -user fabien 
-pidfile /media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.pid 
-wait 10 -outfile 
/media/travail/apache-tomee-plus-1.7.2/logs/catalina-daemon.out -errfile 
&1 -classpath 
/media/travail/apache-tomee-plus-1.7.2/bin/bootstrap.jar:/media/travail/apache-tomee-plus-1.7.2/bin/commons-daemon.jar:/media/travail/apache-tomee-plus-1.7.2/bin/tomcat-juli.jar

-Djava.util.logging.config.file=/media/travail/apache-tomee-plus-1.7.2/conf/logging.properties

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.endorsed.dirs= 
-Dcatalina.base=/media/travail/apache-tomee-plus-1.7.2 
-Dcatalina.home=/media/travail/apache-tomee-plus-1.7.2 
-Djava.io.tmpdir=/media/travail/apache-tomee-plus-1.7.2/temp 
-Djava.library.path=/usr/local/lib org.apache.catalina.startup.Bootstrap

Mime
View raw message