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 17:14:00 GMT
well, i still say that if your going to run with pre-compiled jsp classes,
there is no reason to place you original jsp file in the tomcat dir.

If you would like to see what the servlet mapping for your jsp should look
like, supply the 
"webinc" attribute to your <jspc> task. It will generate the mapping that
you should include in your web.xml file in order to get tomcat to recognize
it.

Added to your task it would look something like:

 <jspc srcdir="${jsproot}" uriroot="${jsproot}" destdir="${jsproot}"
classpathref="project.class.path" verbose="0" failonerror="no"
webinc="generated_xml_snippet.xml">
      <exclude name="general/**/*.jsp" />
      <exclude name="*/**/index.jsp" />
      <include name="*/**/*.jsp" />
    </jspc>

it will produce something like the following:


<!--
Automatically created by Tomcat JspC.
Place this fragement in the web.xml before all icon, display-name,
description, distributable, and context-param elements.
-->

	<servlet>
		<servlet-name>com.myweb.jsp.upload$jsp</servlet-name>
		<servlet-class>com.myweb.jsp.upload$jsp</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>com.myweb.jsp.upload$jsp</servlet-name>
		<url-pattern>/upload/upload.jsp</url-pattern>
	</servlet-mapping>

<!--
All session-config, mime-mapping, welcome-file-list, error-page, taglib,
resource-ref, security-constraint, login-config, security-role,
env-entry, and ejb-ref elements should follow this fragment.
-->


Read up on it at: http://ant.apache.org/manual/OptionalTasks/jspc.html
-----Original Message-----
From: Geiglein, Gary [mailto:geigleing@peacetech.com]
Sent: Friday, May 09, 2003 12:40 PM
To: Ant Users List
Cc: Mike Medwith
Subject: RE: JSPC task and package names


Follow the jspc task with either a copy or move task to place the .java and
the .class files in the correct directory.

If the timestamp on the compiled files is newer than the source (.jsp)
tomcat will not recompile them.

-----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