cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beyaNet Consultancy <beya...@ntlworld.com>
Subject Re: Actions, pipelines, javabeans...
Date Sun, 18 Jan 2004 23:02:04 GMT
Ok Ralph and Morley,
so i have a sitemap that does the following (aggregation):

				<map:match pattern="support/home">
				
					<map:aggregate element="home">
						<map:part src="cocoon:/support/beya-menu" />
						<map:part src="cocoon:/support/contract-summary" />
						<map:part src="context://beyarecords/content/adv-xyz-01.xml" />
						<map:part src="context://beyarecords/content/site_title.xml" />
					</map:aggregate>
					
					<map:transform type="xslt" src="style/home-page.xsl">
						<map:parameter name="user" value="{../1}" />
						<map:parameter name="pass" value="{../1}" />
					</map:transform>
					
					<map:serialize type="html" />
				</map:match>

Now in terms of session persistence and passing parameters around 
(shopping cart), how would I aggregate the parameters from my action 
into my xsl document and avoid the pitfalls of the approach i was 
taking before?

Andrew
On 18 Jan 2004, at 22:47, beyaNet Consultancy wrote:

> Ralph and Morley,
> as I have stated in my earlier message the approach i am currently 
> taking leaves much to be desired, hence the request about JavaBeans. 
> As I am completely new to this cocoon arena, could you please show me 
> an example of what you mean in terms of 'use aggregation and turn your 
> parameters into XML that are aggregated into the document processed by 
> your transform'?
>
> Andrew
>
>
>
> On 18 Jan 2004, at 19:35, Ralph Goers wrote:
>
>> When I first started using Cocoon I too was coding things like you 
>> are. It
>> soon became apparent that this was not a good approach because every 
>> time a
>> new data element had to be added too many things needed to be 
>> modified.  In
>> addition, I believe passing parameters from the sitemap impacts 
>> Cocoon's
>> caching of your transforms.
>>
>> A better approach is to use aggregation and turn your parameters into 
>> XML
>> that are aggregated into the document processed by your transform. 
>> Thus, you
>> won't have to see the parameters in the sitemap at all. Furthermore, 
>> you can
>> use Betwixt or Castor to automatically convert any Java Bean into 
>> XML.  We
>> are doing exactly that to retrieve data from our business tier.
>>
>> Ralph
>>
>> -----Original Message-----
>> From: beyaNet Consultancy
>> To: users@cocoon.apache.org
>> Sent: 1/18/2004 6:44 AM
>> Subject: Actions, pipelines, javabeans...
>>
>> Hi,
>> I have created an action which returns parameters to a pipeline based 
>> on
>> a users login details. I want these details to persist for the du 
>> ration
>> of a user session and wanted to know how to store the values passed 
>> into
>> the pipeline into a JavaBean instead. At the moment I have the
>> parameters coming into my action as so:
>>
>> 1. pipeline
>>
>> 			<map:match pattern="user-details">
>> 				<map:act type="get-detail2">
>> 				    <map:parameter name="user"
>> value="{request-param:user}" />
>> 					<map:parameter name="pass"
>> value="{request-param:pass}" />
>> 					<map:generate type="file"
>> src="content/main.xml" />
>> 					<map:transform
>> src="style/main.xsl">
>> 						<map:transform
>> src="style/main.xsl">
>> 						<map:parameter
>> name="first_name" value="{first_name}" />
>> 						<map:parameter
>> name="last_name" value="{last_name}" />
>> 						<map:parameter
>> name="address1" value="{address1}" />
>> 						<map:parameter
>> name="address2" value="{address2}" />
>> 						<map:parameter
>> name="address3" value="{address3}" />
>> 						<map:parameter
>> name="postcode" value="{postcode}" />
>> 						<map:parameter
>> name="country" value="{country}" />
>> 						<map:parameter
>> name="email" value="{email}" />
>> 						<map:parameter
>> name="home_telephone" value="{home_telephone}" />
>> 						<map:parameter
>> name="mobile_telephone" value="{mobile_telephone}" />
>> 						<map:parameter
>> name="date_joined" value="{data_joined}" />
>> 					</map:transform>
>> 					<map:serialize type="html" />
>> 				</map:act>
>>
>> and are passed into the pipeline from the Action as so:
>>
>> 2. Action
>> 				map.put("user_id", rs.getString(1));
>> 				map.put("first_name", rs.getString(2));
>> 				map.put("last_name", rs.getString(3));
>> 				map.put("address1", rs.getString(4));
>> 				map.put("address2", rs.getString(5));
>> 				map.put("address3", rs.getString(6));
>> 				map.put("postcode", rs.getString(7));
>> 				map.put("country", rs.getString(8));
>> 				map.put("email", rs.getString(9));
>> 				map.put("home_telephone",
>> rs.getString(10));
>> 				map.put("mobile_telephone",
>> rs.getString(11));
>> 				map.put("date_joined",
>> rs.getString(12));
>>
>> and then into my xsl page as so
>>
>> 3. xsl
>> <?xml version="1.0"?>
>>
>> 	<xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> 	
>> 		<xsl:param name="user_id"/>
>> 		<xsl:param name="first_name"/>
>> 		<xsl:param name="last_name"/>
>> 		<xsl:param name="address1"/>
>> 		<xsl:param name="address2"/>
>> 		<xsl:param name="address3"/>
>> 		<xsl:param name="postcode"/>
>> 		<xsl:param name="country"/>
>> 		<xsl:param name="email"/>
>> 		<xsl:param name="home_telephone"/>
>> 		<xsl:param name="mobile_telephone"/>
>> 		<xsl:param name="date_joined"/>
>>
>> Could I call and update the javabean from the within the transform:
>> <map:transform src="style/main.xsl">
>> 	instatiate javabean
>>      javabean.user_id = <map:transform src="style/main.xsl">
>> </map:transform>
>>
>> Or would it be better to do it from within the Action and then just 
>> call
>> the call javabean from within the xsl page itself? ultimately I want 
>> to
>> be able to call the javebean parameters into my xsl or xsp pages. What
>> is the best way to go about doing this? Is there any example code out
>> there I can have a look at?
>>
>>
>> Andrew
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

Mime
View raw message