cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: my first xsp page
Date Wed, 24 Sep 2003 12:49:09 GMT
Simon Bretin wrote:

> Hi,
>
> I think the problem is that you have your java code within <![CDATA[ 
> sections.


No, CDATA ain't problem (but you still can remove it if not necessary). 
CDATA is a way to write '<', '&', '>' characters directly in the XML, 
without encoding them into less readable &lt; &amp; &gt;.


> Another thing, is that right before the <field> line, you should add 
> an <xsp:content> tag.


No, that's not necessary (but won't hurt either). XSP will "switch" to 
content mode automatically once it discovers the tag. You nees this 
xsp:content tag if you want to output text:

<xsp:logic>
  ... some Java ...
  <xsp:content>this is text</xsp:content>
  ... some more Java ...
</xsp:logic>


Regarding "nullPointException": you tried to access an object by null 
reference. Get the source XSP file from the working directory, and go to 
the specified in the exception line number to identify the problematic code.

Vadim



> Basically everything within an <xsp:logic> tag should be some Java 
> code, except for the one being present between <xsp:content> tags.
>
> See the correction inlined if I was not clear enough !
>
> Simon.
>
> Wermus Fernando wrote:
>
>>I have a client class that it has its own names and values´ attributes in a
>>Properties class. I need to convert this in a xml with the tags
>><field><name>blabla</name><value>blabla</value></field>
for each class
>>attribute. I get some errors and I don't know what´s up. Some
>>nullPointException.
>>
>><?xml version="1.0" encoding="ISO-8859-1"?>
>><!-- CVS: $Id: simple.xsp,v 1.3 2002/02/09 06:21:57 vgritsenko Exp $ -->
>><xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>>xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>>xmlns:log="http://apache.org/xsp/log/2.0"
>>xmlns:capture="http://apache.org/cocoon/capture/1.0">
>><page>
>>	<content>
>>	<registry>
>>  
>>
> <xsp:logic><![CDATA[
>
>>			miCliente.Cliente cliente=new miCliente.Cliente(5);
>>			java.util.Properties prop=cliente.getProperties();
>>			java.util.Enumeration
>>propNames=prop.propertyNames();
>>					
>>			String propName="hola";
>>			String property="hola";
>>					
>>			while (propNames.hasMoreElements() ){
>>						
>>				propName=(String) propNames.nextElement();
>>				property=prop.getProperty(propName);
>>						
>>			
>>
> ]]>
> <xsp:content>
>
>>				<field>
>>					<name>
>>	
>><xsp:expr>propName</xsp:expr>
>>					</name>
>>					<value>
>>	
>><xsp:expr>property</xsp:expr>
>>					</value>
>>				</field>
>>			
>>
><![CDATA[
></xsp:content>
>}
>]]>
>					
>		</xsp:logic>
>	</registry>
>	</content>
></page>
></xsp:page>
>  
>



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


Mime
View raw message