<?xml version="1.0" encoding="ISO-8859-1"?> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"> <xsp:structure> <xsp:include>java.io.File</xsp:include> <xsp:include>org.apache.commons.logging.Log</xsp:include> <xsp:include>org.apache.commons.logging.LogFactory</xsp:include> </xsp:structure> <xsp:logic> private final static Log _log = LogFactory.getLog("file-preview"); </xsp:logic> <page> <xsp:logic> String fileName = request.getParameter("file-name"); File file = new File(fileName);
<!-- etc. --> </xsp:logic> </page> </xsp:page> Hope that helps Judith > -----Ursprüngliche Nachricht----- > Von: e.chan [SMTP:[EMAIL PROTECTED]] > Gesendet am: Donnerstag, 23. Mai 2002 14:30 > An: [EMAIL PROTECTED] > Betreff: how to embed java logic into xml page? > > Dear all, > > I am a newbie to cocoon2. I am using cocoon2, with jdk1.3.1, tomcat4.0 and > running on a winXP platform (I am sure most of you disapprove of this! >:) > I am making a prototype using cocoon to connect to a jabber server (like > instant messaging, sort of like JMS) and send messages to jabber clients. > > I was advised to not separate the logic from the main XML code because the > environment which I am using causes a lot of problems when I try to > reference logic sheets in cocoon and it is going to take a while for me to > work out this problem. > > The main thing is to get it to work and refactor it later. Since I am > running out of time for implementation, I want to embed the logic into the > XML file rather than having it in a separate logic sheet. Thus I don't > need to alter the cocoon.xconf and sitemap. > > The logic I am using is java and I have a no. of libraries I need to > include but I am not sure how to declare these in the xml/xsp page. I > have checked out the examples that came with cocoon and the ones with > embedded logic are quite simply "hello world" or some control loop and do > not have a number of different methods and libraries. > > I have searched the mailing list archives to see if there has been a > question and answer already in existence however, I didn't come across > any. > > So far, the mailing list concerns people who split the logic into a logic > sheet. > > Please can someone tell me how embed the java logic with a number of > different methods, and imported libraries into an XSP? Perhaps you can > send me an example XSP file with the java logic embedded which has > libraries and so on (any example is fine, I can follow the structure). Or > are there any other suggestions please let me know. > > > > Any help would be greatly appreciated. > > Kindest regards, > > liz > > Elizabeth Chan > > Masters of Enterprise > > UMIST & Univ. of Manchester > > + 44 (0) 777 1627374 > > "I am extraordinarily patient, provided I get my own way in the end." > Margaret Thatcher > > > > > > Elizabeth Chan > > Masters of Enterprise > > UMIST & Univ. of Manchester > > + 44 (0) 777 1627374 > > "I am extraordinarily patient, provided I get my own way in the end." > Margaret Thatcher > > > > > > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>