I use XMLBeans with quite a number of our Java servlet/JSP applications. 

After compiling the Java objects from schema, I store the xmltypes.jar file
in the %WEBAPP%/WEB-INF/lib directory. So they don't need to be bundled with
each WAR file, I put a single copy of xbean.jar and jsr173_api.jar in the
%TOMCAT_HOME%/common/lib directory. 

Instead of trying to use <jsp:usebean/> tags to use the beans in XML pages,
I just instantiate the XMLObject as needed, then store it as an attribute in
the session. The first JSP page that needs the XMLObject starts by looking
for the XMLObject in the session, and if not there - it instantiates it. All
subsequent JSP pages that need the XMLObject just fetch it from the session.
If not found in the session, then I use <jsp:forward/> to return to the
"first" page that initially created the XMLObject. When no longer needed, I
clear the XMLObject from the session.

Cheers,

~ David

-----Original Message-----
From: Adam Rusbridge [mailto:[EMAIL PROTECTED] 
Sent: July 28, 2005 3:17 AM
To: [email protected]
Subject: xmlbean as a jsp application

Hi,

Does anyone know if it is possible to deploy the xmlbeans jar file as
part of a JSP web application using Tomcat? I receive the following
exception from tomcat:

org.apache.jasper.JasperException: /premis.jsp(1,1) The value for the
useBean class attribute gov.loc.standards.premis.PremisDocument is invalid.

JSP requires that I specify the package followed by the public class
that I wish to use. So, assuming the package was com.test and the class
was TestBean.class I would include the following:

<jsp:useBean id="theBean" class="com.test.TestBean"/>

With my xmlbean, I have identified the package,
gov.loc.standards.premis, and what I believe is the root element,
PremisDocument.

<jsp:useBean id="theBean" class="gov.loc.standards.premis.PremisDocument"/>

However, this seems to declare the interface rather than the class, and
if I understand correctly, there is no xmlbean constructor of that name
taking no arguments. Is this correct? I think that tomcat maybe requires
the class and constructor to be present.

I'm new to tomcat, so not sure if deploying the xmlbean would be
possible anyway, especially considering the dependencies on the
org.apache.xmlbeans class, but would appreciate any ideas to solve this.
Alternatively, if anyone's aware that this isn't possible could someone
point that out so I can move on!

Thanks very much,
Adam

-- 
  Adam Rusbridge
  DCC Development
  HATII, University of Glasgow, Scotland
  Tel: +44 (0)141 330 8591
  Email: [EMAIL PROTECTED]
  Web: www.dcc.ac.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to