You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adrien RUFFIE <a....@e-deal.com> on 2013/01/17 15:38:09 UTC
Jasper compiler for included jsp
Hello all I have following pages :
displayPerson.jsp and displaySocialNetwork.jsp
my first displayPerson.jsp include the second by following tag:
<%@include file="./displaySocialNetwork.jsp"%>
In the first page (displayPerson.jsp) following variable is declared:
<%
String id = person.getId();
%>
And I the second (displaySocialNetwork.jsp) this id is use like:
var ajaxParamID = <%= id %>
But when I try to compile these twice jsp page I get the following error:
cannot find symbol
Thank to following Jasper2 ant task:
<jasper2 uriroot="${webapp.dir}"
package="${jspc.pkg.prefix}"
webXmlFragment="${webapp.dir}/WEB-INF/jspc-web.xml"
outputDir="${webapp.dir}/WEB-INF/jspc-src/${jspc.dir.prefix}"
verbose="${verbose}" failonerror="${failonerror}" classdebuginfo="${classdebuginfo}" listerrors="${listerrors}" compilerSourceVM="${compiler.source.vm}" compilerTargetVM="${compiler.target.vm}"/>
How I can say to jasper2: please include displayPerson.jsp when you try to compile displaySocialNetwork.jsp ? In order to have "id" variable ?
I precise that I cannot modify jsp code, but just ant task
Best regards.
Adrien Ruffié
RE: Jasper compiler for included jsp
Posted by Adrien RUFFIE <a....@e-deal.com>.
Thank Chris for your response,
But I cannot provide you the stacktrace because I have try another solution but nothing ...
I have try to exclude children page compilation because is it already embedded in mother page compilation.
I have try following exclusion solution, but neither doesn't work correctly:
1 solution (exclude in jasper generation):
<target name="generate-jsp-java-src">
<mkdir dir="${webapp.dir}/WEB-INF/jspc-src/${jspc.dir.prefix}"/>
<taskdef classname="org.apache.jasper.JspC" name="jasper2">
<classpath>
<path refid="jspc.classpath"/>
</classpath>
</taskdef>
<touch file="${webapp.dir}/WEB-INF/jspc-web.xml"/>
<jasper2 uriroot="${webapp.dir}"
package="${jspc.pkg.prefix}"
webXmlFragment="${webapp.dir}/WEB-INF/jspc-web.xml"
outputDir="${webapp.dir}/WEB-INF/jspc-src/${jspc.dir.prefix}"
verbose="${verbose}" failonerror="${failonerror}" classdebuginfo="${classdebuginfo}" listerrors="${listerrors}" compilerSourceVM="${compiler.source.vm}" compilerTargetVM="${compiler.target.vm}"/>
<include name="**" />
<!-- because jsp complied name can be read_004f_inectn122d_jsp.java -->
<exclude name="${webapp.dir}/WEB-INF/marketing/*inectn*.java"/>
<exclude name="com/my/webapp /common/**" />
</target>
2 solution (exclude in javac compilation):
<target name="compile-jsp-servlets" depends="generate-jsp-java-src">
<mkdir dir="${webapp.dir}/WEB-INF/classes"/>
<javac srcdir="${webapp.dir}/WEB-INF/jspc-src"
destdir="${webapp.dir}/WEB-INF/classes"
includes="**/*.java"
debug="${debug}"
debuglevel="${debuglevel}"
deprecation="${deprecation}"
encoding="${encoding}"
optimize="${optimize}"
source="${source.version}"
compiler="${build.compiler}"
nowarn="${nowarn}">
<classpath>
<path refid="jspc.classpath"/>
</classpath>
<compilerarg line="-Xmaxerrs 5000"/>
<compilerarg line="-Xmaxwarns 5000"/>
<include name="**" />
<exclude name="${webapp.dir}/WEB-INF/marketing/*inectn*.java"/>
<exclude name=" com/my/webapp/common/**" />
</javac>
</target>
Do you have an idea why previous target cannot exclude files correctly ?
Bien cordialement,
Adrien Ruffié
LD : +33 1 73 03 29 50
Tél : +33 1 73 03 29 80
E-DEAL
Innover la Relation Client
-----Message d'origine-----
De : Christopher Schultz [mailto:chris@christopherschultz.net]
Envoyé : jeudi 17 janvier 2013 19:04
À : Tomcat Users List
Objet : Re: Jasper compiler for included jsp
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Adrien,
On 1/17/13 9:38 AM, Adrien RUFFIE wrote:
> Hello all I have following pages : displayPerson.jsp and
> displaySocialNetwork.jsp
>
> my first displayPerson.jsp include the second by following tag:
> <%@include file="./displaySocialNetwork.jsp"%>
>
> In the first page (displayPerson.jsp) following variable is
> declared: <% String id = person.getId(); %>
>
>
> And I the second (displaySocialNetwork.jsp) this id is use like:
>
> var ajaxParamID = <%= id %>
>
>
> But when I try to compile these twice jsp page I get the following
> error:
>
> cannot find symbol
Please post the full error message. I suspect the problem is that
jasper2 can't compile the *fragment* displaySocialNetwork.jsp, not that it can't compile displayPerson.jsp.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEAREIAAYFAlD4PRgACgkQ9CaO5/Lv0PBvKwCfbcHWIEZt7yHKdJxpsSgx4Vd2
uUcAn0TLwBYu/DBFmvQZpzz8zVGCFgLI
=QuN3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Jasper compiler for included jsp
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Adrien,
On 1/17/13 9:38 AM, Adrien RUFFIE wrote:
> Hello all I have following pages : displayPerson.jsp and
> displaySocialNetwork.jsp
>
> my first displayPerson.jsp include the second by following tag:
> <%@include file="./displaySocialNetwork.jsp"%>
>
> In the first page (displayPerson.jsp) following variable is
> declared: <% String id = person.getId(); %>
>
>
> And I the second (displaySocialNetwork.jsp) this id is use like:
>
> var ajaxParamID = <%= id %>
>
>
> But when I try to compile these twice jsp page I get the following
> error:
>
> cannot find symbol
Please post the full error message. I suspect the problem is that
jasper2 can't compile the *fragment* displaySocialNetwork.jsp, not
that it can't compile displayPerson.jsp.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEAREIAAYFAlD4PRgACgkQ9CaO5/Lv0PBvKwCfbcHWIEZt7yHKdJxpsSgx4Vd2
uUcAn0TLwBYu/DBFmvQZpzz8zVGCFgLI
=QuN3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org