Ozoren-san wrote:
> I_ve been trying to get cocoon and struts together, however one is using the
> servlet.jar the other servlet_2_2.jar.
>
> Is it possible to combine these two?
Yes, I've done it. I'm using Struts and Cocoon both in the same context.
There are a few things you have to work out first, though.
First of all, I'm using Tomcat, so you many need to modify these
instructions for your platform.
/usr/local/tomcat/lib:
ant.jar servlet.jar webserver.jar
jasper.jar test xerces.jar
As you can see, jaxp.jar and parser.jar have been removed from Tomcat's
application level lib directory, and xerces.jar (CVS as of 3/24) has been
dropped in. Also, I'm only using servlet.jar, which I belive is the same
as servlet_2_2.jar. At least for the version of Tomcat that I'm using.
/usr/local/tomcat/webapps/myproject/WEB-INF/lib:
avalonapi.jar juli.jar xalan.jar
batic-all.jar junit.jar xalanj1compat.jar
bsf.jar kfc.jar xml4j.jar
cocoon-2.0a4.jar logkit.jar xsl.jar
fop.jar maybeupload.jar xt.jar
jakarta-regexp-1.2.jar rhino.jar xuras.jar
javac.jar struts.jar
jstyle.jar w3c.jar
No, all of those aren't necessary. I'm still weeding out the jar files
that I don't need. Note also that xalan.jar is the CVS build from 3/24.
There was an awful bug in the downloadable Xalan 2.0.0 that caused the
.tld's to be built incorrectly.
Also note that I'm using Cocoon 2 alpha. I had a hard time getting Cocoon
1 to play nicely with JSP's, and the only way that I got it to work was to
put all of the Cocoon related .jar files into /usr/local/tomcat/lib. That
makes it harder to package a project, as one simply can't do it with a
.war file.
Finall, add the following to your WEB-INF/web.xml:
<!-- Use Cocoon2 for SXLT -->
<servlet>
<servlet-name>Cocoon2</servlet-name>
<display-name>Cocoon2</display-name>
<description>The main Cocoon2 servlet</description>
<servlet-class>org.apache.cocoon.servlet.CocoonServlet</servlet-class>
<init-param>
<param-name>configurations</param-name>
<!-- CHANGE PATH BELOW -->
<param-value>/WEB-INF/cocoon.xconf</param-value>
</init-param>
<init-param>
<param-name>log-level</param-name>
<param-value>DEBUG</param-value>
</init-param>
</servlet>
<!-- Servlet Mapping for Cocoon2 -->
<servlet-mapping>
<servlet-name>Cocoon2</servlet-name>
<url-pattern>*.xsp</url-pattern>
</servlet-mapping>
Notice that I'm just mapping *.xsp to Cocoon? That's because if I map
Cocoon to /, it tries to take everything -- the .jsp's included. (I
didn't test to see if .do's came out OK. You might want to try that.
I had tried to have everything under a given directory controlled by
Cocoon (<url-pattern>/dynamic/xsp</url-pattern>), but the .xmap had a hard
time finding things. If you understand Cocoon's architecture well enough,
it may be possible. But I was too strapped for time to investigate
further.
I put cocoon.xconf under WEB-INF, but the .xmap file had to be in the
public area. I'm not sure why that was, and just went with what worked.
(Yes, there are quite a few things that I still need to learn, but I get
it to work first, clean it up later.)
This is kind of off topic for Struts. But I hope this helps.
P.S. The text of you message was 255 bytes, yet the HTML version was 4.1K
bytes. Is all of that HTML necessary? Shouldn't it be disabled for
writing to mailing lists?
--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home: http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/