cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Piroumian" <kpiroum...@apache.org>
Subject Re: <xsp:structure> - question
Date Thu, 16 Jan 2003 14:12:54 GMT
From: <Johannes.Becker@o2.com>

>
> OK. Still not running.
>
> web.xml:
> <init-param>
>       <param-name>extra-classpath</param-name>
>       <param-value>WEB-INF/classes/fraud_management</param-value>
>  </init-param>

This is not required usually.

>
> java-Class in ".../cocoon/Web-Inf/classes/fraud_managment":

correct.

> package fraud_management;
> class execute_report {

Is your class 'public'?

>
>   public String get_fraud()
>   {
>     String hello = "Servus";
>     return hello;
>   }
> }
>
> xsp:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsp:page language="java"
>       xmlns:xsp="http://apache.org/xsp">
>
>   <xsp:structure>
>       <xsp:include>fraud_management.execute_report</xsp:include>
> </xsp:structure>
>
>   <results>
>     <xsp:logic>
>          execute_report er = new execute_report();
>          String hello = er.get_fraud();
>          <option>
>     <xsp:logic>
>           <xsp:attribute name
> ="bla"><xsp:expr>hello</xsp:expr></xsp:attribute>
>         </xsp:logic>
>       </option>
>    </xsp:logic>
>       </results>
> </xsp:page>
>
> I have a feeling that I don't get the entries in the web.xml
> >>
>
<param-value>WEB-INF/extra-classes1:/[YOU-ABSOLUTE-PATH-TO]/own.jar</param-v
alue>
> Do I have to insert additionally the class name? e.g. for Windows systems
>
<param-value>WEB-INF/classes/fraud_managment;C:/Apache.../fraud_managment/ex
ecute_report.class</param-value>

No, you should be able to access your classes if they are placed in
WEB-INF/classes as .class files or if they are placed in WEB-INF/lib as a
.jar archive.

Konstantin

>
> Thanks
> Jonny
>
>
> --------------------------------------------------------------------------
--------------------------
>
> This electronic message contains information from the mmo2 plc Group which
> may be
> privileged or confidential. The information is intended to be for the use
> of the
> individual(s) or entity named above. If you are not the intended recipient
> be aware
> that any disclosure, copying, distribution or use of the contents of this
> information
> is prohibited. If you have received this electronic message in error,
> please notify
> us by telephone or email (to the numbers or address above) immediately.
>
>
>
> |---------+---------------------------->
> |         |           "Geoff Howard"   |
> |         |           <cocoon@leveragew|
> |         |           eb.com>          |
> |         |                            |
> |         |           01/15/03 07:37 PM|
> |         |           Please respond to|
> |         |           cocoon-users     |
> |         |                            |
> |---------+---------------------------->
>
>---------------------------------------------------------------------------
---------------------------------------------------|
>   |
|
>   |       To:       <cocoon-users@xml.apache.org>
|
>   |       cc:
|
>   |       Subject:  RE: <xsp:structure> - question
|
>
>---------------------------------------------------------------------------
---------------------------------------------------|
>
>
>
>
> > -----Original Message-----
> > From: Johannes.Becker@o2.com [mailto:Johannes.Becker@o2.com]
> > Sent: Wednesday, January 15, 2003 11:45 AM
> > To: cocoon-users@xml.apache.org
> > Subject: <xsp:structure> - question
> >
> >
> > Hi,
> >
> > I want to include my own Java-Class in my XSP-Page
>
> <snip/>
>
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <xsp:page language="java"
> >       xmlns:xsp="http://apache.org/xsp">
> >
> >   <xsp:structure>
> >       <xsp:include> <!-- Meine Klasse "execute_report" --></xsp:include>
> > </xsp:structure>
>
> correct.
>
> >
> >   <results>
> >      <xsp:logic>
> >         String hello = null;
> >         hello = get_g();
> >         <option>
> >            <xsp:logic>
> >                <xsp:attribute name="bla">hello</xsp:attribute>
> change the last line to:
>                               <xsp:attribute name
> ="bla"><xsp:expr>hello</xsp:expr></xsp:attribute>
>
> You don't state what "doesn't work" but if you mean the page returned only
> a
> literal attribute bla="hello" then this should be your only problem from
> what I can see.
>
>
> >            </xsp:logic>
> >        </option>
> >    </xsp:logic>
> >   </results>
> > </xsp:page>
> >
> >
> > Where do I have to place my Java-Class. Under .../cocoon/Web-Inf/classes
> > (where I hava placed it right now!)?
>
> yes, that works - make sure that if your class is declared part of a
> package
> that you replicate the directory structure under WEB-INF/classes (many
> people seem to make that mistake)
>
> > How do I call methods, like my method get_g()?
>
> The same way you would from any java class (your usage above should work
> fine) since XSP generates and compiles a java file the first time your
page
> is executed.  I would highly recommend going to take a look at it.  It's
> under your servlet container's work directory - most likely
>
$TOMCAT_HOME/work/Standalone/localhost/cocoon/cocoon-files/org/apache/cocoon
>
> /www/jonny/filename_xsp.java - you may have to browse around for it if
I've
> made incorrect guesses.
>
>
> HTH,
> Geoff Howard
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message