Hey guys,

I'm hoping you could help me out with a project I've been tasked with.

I'm gonna ask the simple question now, and go into more detail below:

How can one have a Logic Sheet helper class, that just runs a method stored
in a new custom java class? And does anyone have an example of this.

Something simple like a helloworld that would just type HelloWorld on the
screen, but where the code to type helloworld wasn't stored in the logic
sheet. 

Or better, the previous example modified to where I could pass my name as a
variable that the helper java class would pick up and then pass over to the
helloworld statement.

So it would say, Hello David, instead of just something hard coded in the
java code.

Anyone have any ideas/reference materials?

Thanks in advance for your help on this issue!!

david

**Begin More Detailed Explanation**

I'm trying to figure out, how to access a custom made java program through a
logic sheet/helper class type system.

Specifically something like what I describe below:

I have inside my logic sheet something that defines a "TCAdmin" instance,
and then runs that instance.

Without the lines I have in ***, and with the original example it works
just fine. But the "guts" of the java code are actually IN the logic sheet.
I want them outside the logic sheet and be able 2 call them.

  <xsl:template match="xsp:page">
    <xsp:page>
      <xsl:apply-templates select="@*"/>

        <!-- Add needed imports -->
      <xsp:structure>
        <xsp:include>java.util.Date</xsp:include>
        <xsp:include>java.text.SimpleDateFormat</xsp:include>
***        <xsp:include>TCAdmin</xsp:include> ***
      </xsp:structure>

        <!-- Add class-level logic: methods, variables -->
        <xsp:logic><![CDATA[
                public static String formatDate(Date value, String format) {
                        SimpleDateFormat formatter;
***                        TCAdmin tadm; ***
***                        tadm = new TCAdmin(); ***
***                        tadm.status(); ***
                        format = format.trim();
                        if (format != null && !"".equals(format)) {
                                formatter = new SimpleDateFormat(format);
                        }
                        else {
                                formatter = new SimpleDateFormat();
                        }
                        
                        return formatter.format(value);
                }
        ]]>
        </xsp:logic>

      <xsl:apply-templates/>

    </xsp:page>
  </xsl:template>

When I try and access this I get the following error complaining about it
not being able to access the TCAdmin Class:

description org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
simple_xsp: Line 72, column 24: class TCAdmin not found in class
org.apache.cocoon.www.spain.simple_xsp Line 73, column 35: class TCAdmin not
found in class org.apache.cocoon.www.spain.simple_xsp Line 0, column 0: 2
errors 

However, when I excecute this java class through dos using another java
class it works exactly as you would think, typing the print statement that I
have in the java class.

---------------------------------------------------------------------
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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to