ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Priest <Robert.Pri...@bentley.com>
Subject RE: JSPC task and package names
Date Fri, 09 May 2003 16:27:13 GMT


This is for some app that run's on tomcat.But they do give an example of
what the web.xml entry would look like for a pre-compiled jsp file.

http://www.adventnet.com/products/webnms/help/developer_guide/html_client_fr
amework/html_compile_jsp_servlet.html#precompiled%20process

-----Original Message-----
From: Robert Priest [mailto:Robert.Priest@bentley.com]
Sent: Friday, May 09, 2003 12:00 PM
To: 'Ant Users List'; ant-user@apache.org
Subject: RE: JSPC task and package names


okay, mike. That works...partly...

As you instructed, here is what my task looks like:
<property name="JSP_ROOT" value="${WEB_MAIN}/src/java/jsp"/>
 <echo message="BUILDING JSP FILES...."/>
  <jspc 
      srcdir="${JSP_ROOT}"
      destdir="${JSP_ROOT}"
      uriroot="${JSP_ROOT}"
      package="com.projectwise.web.jsp"
      verbose="9"
    <include name="**/*.jsp" />
   ...
  </jspc>
this is what is happening:

I have a jsp file under:

src/java/jsp/upload/upload.jsp

when <jspc/> runs it puts the resulting java file under

src/java/jsp/upload$jsp.java


What I would like is for the resulting java file to be placed under the the
same directory as the original ".jsp" file.

So, upload$jsp.java should really be under:

src/java/jsp/upload/upload$jsp.java



For your issue:
So let me get this right: Tomcat is still compiling the file at runtime, and
you want it to use your pre-compiled class file, correct?


If that is the case, From what I have read, if you have precompiled the jsp,
then you have to treat it like a servlet. This means that in order for
tomcat to see it, you have to have a servlet entry in the web.xml file for
it. Just like a servlet. And, if you already have the precompled jsp class
file, then I would not have the original jsp file in the running
installation of tomcat. You should just have the class file in the
WEB-INF\classes dir.


I believe it is something like:

<servlet> 
    <servlet-name>jsp.TestPage</servlet-name> 
    <servlet-class>jsp.TestPage</servlet-class> 
</servlet> 
 <servlet-mapping> 
   <url-pattern>/jsp/TestPage.jsp</url-pattern> 
   <servlet-name>jsp.TestPage</servlet-name> 
</servlet-mapping>


I read that somewhere. I am trying to find the site now :)

-----Original Message-----
From: Mike Medwith [mailto:mmedwith@hotmail.com]
Sent: Friday, May 09, 2003 10:59 AM
To: ant-user@apache.org
Subject: RE: JSPC task and package names


Actually I am getting the package "org.apache.jsp" which matches what tomcat
does to the jsp files.  What I dont understand is tomcat compiles each java
version to the same directory as the jsp file for example:

test.jsp is under /general/jsp
test_jsp.java is place in the work directory under: /general/jsp
test_jsp.class is compiled by tomcat with the package "org.apache.jsp" but
under: /general/jsp
ant compiles the java file under: /org/apache/jsp and tomcat cannot find it
and recompiles the jsp itself

Any ideas?

for your problem change the destdir in the jspc task to the base dir for the
jsps.... the "." will just put them wherever you curretnly are.....

my tasks are a little messy I had to break up the compilation I run AIX
which doesn't like more than a few hundred files at once and I am up to 400
or something.....


  <!-- jspc/javac task -->
  <target name="jasper_jsp">
    <echo message="Jaspering JSPs (converting .jsp to .java)" />
    <jspc srcdir="${jsproot}" uriroot="${jsproot}" destdir="${jsproot}"
classpathref="project.class.path" verbose="0" failonerror="no">
      <exclude name="general/**/*.jsp" />
      <exclude name="*/**/index.jsp" />
      <include name="*/**/*.jsp" />
    </jspc>
    <jspc srcdir="${jsproot}" uriroot="${jsproot}" destdir="${jsproot}"
classpathref="project.class.path" verbose="0" failonerror="no">
      <include name="general/**/*.jsp" />
    </jspc>
  </target>

  <target name="compile_jsp">
    <echo message="Compiling JSPs for tomcat" />
    <javac srcdir="${jsproot}"
           destdir="${jsproot}"
           verbose="no"
           failonerror="no"
           classpathref="project.class.path">
      <include name="**/*.java"/>
    </javac>
  </target>

-Mike

-------------------------------------------
hello mike.

Funny you should say that,because I think I am having the opposite problem.
First I think you need to define define the

package="com.mypackage.jsp"
in your <jspc/> task.

But my problem is that I actually want the java files to be placed in the
the same directory as the original jsp file for now. But it is placing them
in the Base dir of the ant project. In addition it
is not creating the subdirectory names based off of the package attribute I
supplied to my task. I guess it is because of the fact that I defined
srcdir=".".

But what do I define it to have the files placed where I want them and the
subdirectories based off of that package name?


Here is what my task looks like:
  <jspc
      srcdir="."
      destdir="."
      uriroot="."
      package="com.projectwise.web.jsp"
      verbose="9">
  <include name="**/*.jsp" />
   <classpath>
      <pathelement path="${env.CLASSPATH}"/>
      <path refid="classpath"/>
      <pathelement
location="${TOMCAT_SOURCE}common/lib/jasper-compiler.jar"/>
      <pathelement
location="${TOMCAT_SOURCE}common/lib/jasper-runtime.jar"/>
    </classpath>

</jspc>

Can You show my what your jspc tasks looks like?

-----Original Message-----
From: Mike Medwith [mailto:mmedwith@hotmail.com]
Sent: Thursday, May 08, 2003 3:05 PM
To: user@ant.apache.org
Subject: JSPC task and package names


All my jsps end up with a package name of org.apache.jsp and when these
files are compiled they are placed under those directories instead of the
subdirectories where the original jsp and java file curretnly live... is
there any way to keep the package name the same as the sub dirs that the
jsps are found in?

-Mike

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Mime
View raw message