cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: Using existing jsp file
Date Mon, 02 Feb 2004 23:19:28 GMT
On 03.02.2004 00:00, Anna Bikkina wrote:

> I need the output in the cocoon pipelines. I am already using the jspReader 
> but it gives me errors.  Below is the sitemap that I am using to generate jsp 
> pages. Is JSPReader another option of JTidy/JSPGenerator. 

You still have the explanation of the two components in your sitemap:

JSPGenerator: JspGenerator is used to get result of a JSP page then 
output it as XML (SAX events)

JSPReader: JSPReader is used to serve direct output from a JSP page. 
Note, that JSP result can be non XML

This means the reader has no problem with reading non-XML as it does not 
have to create SAX events out of it. It just outputs the result to the 
client.

The JSPGenerator *does* generate SAX events of it, i.e. it parses the 
JSP output. But this will only work with well-formed XML output.

When I asked for the need of the JSP output in the pipelines I meant the 
SAX events. If it is enough for you to give the JSP output directly to 
the client, you do not need to parse it. Only if you need the SAX 
events, e.g. for manipulating them via a transformer, you need the 
tidying JSPGenerator.

You said you got errors with JSPReader? What's the error? It should work 
the same way like JSPGenerator (besides the parsing of course).

Joerg

> <?xml version="1.0"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> 
>   <!-- =========================== Components ================================ 
> -->
>   <map:components>
>     <map:generators default="file">
>       <!-- JspGenerator is used to get result of a JSP page 
>            then output it as XML (SAX events)
>       -->
>       <map:generator logger="sitemap.generator.jsp" name="jsp"
>                      src="org.apache.cocoon.generation.JspGenerator"/>
>     </map:generators>
>     <map:transformers default="xslt"/>
>     <map:readers default="resource">
>       <!-- JSPReader is used to serve direct output from 
>            a JSP page. Note, that JSP result can be non XML  -->
>       <map:reader logger="sitemap.reader.jsp" name="jsp" 
>                   src="org.apache.cocoon.reading.JSPReader"/>
>     </map:readers>
>     <map:serializers default="html"/>
>     <map:matchers default="wildcard"/>
>     <map:selectors default="browser"/>
>   </map:components>
> 
>   <!-- =========================== Pipelines ================================= 
> -->
>   <map:pipelines>
>     <map:pipeline>
>       <!-- This works only if TreeProcessor is used -->
>       <map:match pattern="">
>         <map:redirect-to uri="welcome.htm" />
>       </map:match>
> 
>       <map:match pattern="*.htm">
>         <map:read type="jsp" src="{1}.jsp" mime-type="text/html" />
>       </map:match>
> 
>       <!-- Use this to debug your JSPs -->
>       <map:match pattern="*.xml">
>         <map:generate type="jsp" src="{1}.jsp"/>
>         <map:serialize type="xml"/>
>       </map:match>
> 
>       <map:match pattern="*.jsp">
>         <map:generate type="jsp" src="{1}.jsp"/>
>         <map:serialize type="html"/>
>       </map:match>
>       
>           <!--+
>     | Mount everything else by calling the sitemap.xmap file located
>     | in the requested folder.
>     +-->
>     <map:match pattern="*/**">
>       <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/>
>     </map:match>
> 
>     </map:pipeline>
>   </map:pipelines>
> </map:sitemap>
> <!-- end of file -->
> 
> 
> On Monday 02 February 2004 05:46 pm, Joerg Heinicke wrote:
> 
>>On 02.02.2004 23:24, Anna Bikkina wrote:
>>
>>>Looks like my jsp pages are not well formatted xml docs. They are more
>>>html stuff with jsp tags. Can anyone help me use the same jsps without
>>>rewriting the existing ones. Rewriting them would be a lot of work and we
>>>do not have so much time to complete the project.
>>
>>Do you need the output of the JSP in the Cocoon pipelines? If not you
>>can use JSPReader. Otherwise you need to extend the JSPGenerator with
>>the JTidy functionality as in HTMLGenerator.
>>
>>Joerg

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


Mime
View raw message