You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jay <bl...@teleport.com> on 2001/03/20 05:56:23 UTC

XML using multiple XSL style sheets? or JSP vs XML

As I move into XML development from JSP I'm trying to understand how to best
build out a web site thinking in XML.  In doing so I find myself constantly
thinking how would I do this with a servlet/JSP.

For example, I might write a user login form page.

With JSP I might use the same JSP to prompt for the username/password,
redirect to itself to validate username and password, then, if invalid,
either reprompt for a new data or redirect to an error page, or, if valid,
redirect to a "welcome" page.  The JSP could use several templates for
headers and footers but otherwise all formatting would likely be in the JSP.
A JSP template included in all other pages of the site might use a bean to
confirm that the user is logged on (using session variables set at login)
before displaying the page or redirecting to the login page if they aren't.

With XML (in cocoon) I would expect to use an XSP page to handle the login
form processing similarly to the JSP above.  I would use an XSL stylesheet
to define the formatting for output.  Then on all other (xml) pages of the
site I might use a java taglib to check that the user is logged on properly
(again using session variables to confirm that).

Sound right?

My second question is in using an xml page, say login.xml, to do the login,
could that xml page be processed by two xsl stylesheets - one that is used
on all pages of the site for site-wide styles such as header, footer, and
general text formatting and then another stylesheet to format specifics
related to that particular output page, such as formatting the form input
tables?

Ok, I'll cut this short, but I'd appreciate any thoughts on XML vs JSP site
development differences/similarities.






---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Problem Rendering PDF

Posted by Bryan Hansen <me...@xmission.com>.
I am trying to run one of the samples, that came with the download,   
from the command line. I am getting a null pointer exception and am   
wondering if I am trying to run the sample incorrectly or if I have it
configured wrong? I have included the stack trace.                    
                                                                      
Win 2000                                                              
Cocoon 1.8.2                                                          
Java 1.3 (Sun)                                                        
                                                                      
Thanks for any help you could provide!                                
                                                                      
                                                                      
Stack Trace:                                                          
C:\cocoon-1.8.2\bin>java -classpath                                   
%classpath%;./cocoon.jar;C:\cocoon-1.8.2\lib\org.apache.cocoon.Cocoon 
-p C:\cocoon-1.8.2\conf\cocoon.properties                             
C:\cocoon-1.8.2\samples\fo\test-fo.xml ./output.pdf                   
                                                                      
FOP_VERSION = FOP 0.15                                                
FOP_VERSION_NO = 0.15                                                 
using renderer org.apache.fop.render.pdf.PDFRenderer                  
using element mapping org.apache.fop.fo.StandardElementMapping        
using element mapping org.apache.fop.svg.SVGElementMapping            
using property list mapping                                           
org.apache.fop.fo.StandardPropertyListMapping                         
using property list mapping org.apache.fop.svg.SVGPropertyListMapping 
building formatting object tree                                       
WARNING: property 'page-master-name' ignored                          
WARNING: Unknown formatting object                                    
http://www.w3.org/1999/XSL/Format^sequence-specificatio               
n                                                                     
WARNING: Unknown formatting object                                    
http://www.w3.org/1999/XSL/Format^sequence-specifier-re               
peating                                                               
WARNING: A 'flow-name' is required for fo:flow. This constraint will  
be enforced in future                                                 
 versions of FOP                                                      
WARNING: Unknown value for property 'text-align': centered            
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': justified           
WARNING: Unknown value for property 'text-align': centered            
WARNING: Unknown value for property 'text-align': justified           
setting up fonts                                                      
formatting FOs into areas                                             
 [1]                                                                  
rendering areas to PDF                                                
writing out PDF                                                       
Exception in thread "main" java.lang.NullPointerException             
        at org.apache.cocoon.Engine.handle(Engine.java:484)           
        at                                                            
org.apache.cocoon.EngineWrapper.handle(EngineWrapper.java:87)         
        at org.apache.cocoon.Cocoon.main(Cocoon.java:311)             

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XML using multiple XSL style sheets? or JSP vs XML

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
Hi!

> As I move into XML development from JSP I'm trying to understand how to
best
> build out a web site thinking in XML.  In doing so I find myself
constantly
> thinking how would I do this with a servlet/JSP.
>
> For example, I might write a user login form page.
>
> With JSP I might use the same JSP to prompt for the username/password,
> redirect to itself to validate username and password, then, if invalid,
> either reprompt for a new data or redirect to an error page, or, if valid,
> redirect to a "welcome" page.  The JSP could use several templates for
> headers and footers but otherwise all formatting would likely be in the
JSP.
> A JSP template included in all other pages of the site might use a bean to
> confirm that the user is logged on (using session variables set at login)
> before displaying the page or redirecting to the login page if they
aren't.

I have done exactly the same thing with XSP. See below...

> With XML (in cocoon) I would expect to use an XSP page to handle the login
> form processing similarly to the JSP above.  I would use an XSL stylesheet
> to define the formatting for output.  Then on all other (xml) pages of the
> site I might use a java taglib to check that the user is logged on
properly
> (again using session variables to confirm that).

To check for login you can create a taglib (or maybe use the Auth taglib,
see the 3rd party page at http://xml.apache.org/cocoon) and use taglib in
every page that needs to be logged in.

The other way of restricting access to resources is to use the servlet
engine's possibilities (see Servlet API 2.3 specification; as I know latest
versions of Tomcat support that feature):
you simply declare resources and access rights (roles) for them in the
web.xml file. IMO, the second way is better, because you can simply change
your authentication method (Basic, Form, maybe Digest) and you can simply
use different authentication realms (RDBMS, LDAP, a text file, xml file).

>
> Sound right?
>
> My second question is in using an xml page, say login.xml, to do the
login,
> could that xml page be processed by two xsl stylesheets - one that is used
> on all pages of the site for site-wide styles such as header, footer, and
> general text formatting and then another stylesheet to format specifics
> related to that particular output page, such as formatting the form input
> tables?

I used one stylesheet, say main.xsl,  where I declared templates for the
<page> element, etc and done all the common formatting: <HTML>...<BODY
bgcolor="green"><img src="logo.gif">...<xsl:apply-templates
/></BODY></HTML>.
Then I used <xsl:import> in my login.xsl to use that templates and created
only templates for the body part of the page:
<xsl:template match="login-form">
    <!-- do all the unique formatting -->
</xsl:template>

>
> Ok, I'll cut this short, but I'd appreciate any thoughts on XML vs JSP
site
> development differences/similarities.

Look at this article on that subject:
http://www.onjava.com/pub/a/onjava/2001/02/22/jsp_servlets.html

Regards,
    Konstantin Piroumian.

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>