You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Anna Bikkina <an...@pinksheets.com> on 2004/02/23 19:01:16 UTC

Actions and parameters in sitemap

Hi,

I am using multiple action classes to validate my date. I want to display 
error message depending on which action class has failed. I am trying to do 
something like this because that fails. Can someone suggest me how can I do 
this.

I am adding a parameter ERROR after every act and trying to use it in the xsp 
and displaying it. I am not able to get it in the security.xsp.ERROR 
parameter is returning null. Can some suggest a working idea to solve my 
problem.

    <map:match pattern="security.xsp">
    	<map:act type="validator">
    		<map:parameter name="descriptor" value="/usr/local/jboss/tomcat/webapps/
cocoon/historyserver/styles/descriptor.xml"/>
    		
    		<map:act type="startdate" src="security.xsp">
			<map:parameter "ERROR"  value="Invalid start date"/>
    		    	<map:act type="enddate" src="security.xsp">
				<map:parameter "ERROR"  value="Invalid end date"/>
    		    	<map:act type="validateothers" src="security.xsp">
				<map:parameter "ERROR"  value="Invalid other data"/>
    		   		<map:act type="get-security">    			
    		   			
		    		<map:generate type="serverpages" src="securityresult.xsp"/>		    			
		    		<map:transform src="search.xsl"/>     				    
				     <map:serialize/>    
    			</map:act>
    			</map:act>
    			</map:act>
    		</map:act>
    
    	
     <map:generate src="security.xsp" type="serverpages"/>
	  
     	
     <map:transform src="search.xsl"/>     
     
     <map:serialize/>    
   </map:match>


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


Re: AW: Actions and parameters in sitemap

Posted by Anna Bikkina <an...@pinksheets.com>.
Thank you for the replies. I am using request now to send error messages. That 
works.

Thanks once again
Anna.

On Wednesday 25 February 2004 02:38 am, Marco Rolappe wrote:
> hi anna,
>
> the <map:act> containers form kind of scopes. as illustrated by neil, you
> have to reference variables from outer 'scopes' via a corresponding 'path'
> expression. that whole issue is a bit... dunno. but that's one reason not
> to use actions.
>
> contrived example:
>
> ...
> 	<map:act type="act1"> <!-- returns a parameter 'foo' -->
> 		<map:act type="act2"> <!-- returns a parameter 'bar' -->
> 			<map:parameter name="foo" value="{foo}"/>
>
> 			<map:redirect-to uri="{../foo}{bar}"/>
> 		</map:act>
> 	</map:act>
> ...
>
> an important one to note here is act2's parameter 'foo'; since it's a
> parameter to act2 it's not in act2's 'scope', even though the placement of
> the <map:parameter> might suggest so. thus the reference is {foo} and not
> {../foo}; just think of it as a call from within act1's scope: act2(foo:
> {foo})
> this is in contrast to the <map:redirect-to>, which is inside act2's scope.
> so you have to reference the parent scope for 'foo' and the current scope
> for 'bar'.
>
> regarding error flagging there are several possibilities; if you stay in
> the same pipeline (no redirects, etc.) you can use request attributes. when
> redirecting or similar you could pass an error code or message as request
> parameter(s), e.g. <map:redirect-to
> uri="cocoon:/handle-my-err?fail=act1"/>. the last resort would be setting a
> session attribute.
>
> > -----Ursprüngliche Nachricht-----
> > Von: users-return-63503-m_rolappe=web.de@cocoon.apache.org
> > [mailto:users-return-63503-m_rolappe=web.de@cocoon.apache.org]Im Auftrag
> > von Anna Bikkina
> > Gesendet: Dienstag, 24. Februar 2004 23:38
> > An: users@cocoon.apache.org
> > Betreff: Re: Actions and parameters in sitemap
> >
> >
> > Can someone please answer the below question.
> >
> > Also I have nested acts and when the 1st act sends parameters
> > will they be
> > replaced by the second acts parameters(key in the hashmap are
> > different so I
> > guess they cannot be replaced). But when I ampassing all these parameters
> > (from act1 and act2) to the generator the latest act(act2) parameters are
> > being sent the xsp the others (act1 return parameters are not
> > being sent).
> > Can you someone tell me if I am doing anything wrong.
> >
> >
> > 		<map:act type="startdate" src="security.xsp">
> >
> >     		   		<map:act type="get-security">
> >
> > 		    		<map:generate type="serverpages"
> > src="securityresult.xsp">
> > 		    			<map:parameter
> > name="act2msg1" value="{sec_shortname}"/>
> > 		    			<map:parameter
> > name="act2msg2" value="{sec_piggyback}"/>
> > 		    			<map:parameter
> > name="act1msg1" value="{startdate}"/>
> > 		    			<map:parameter
> > name="act1msg2" value="{enddate}"/>
> > 		    		</map:generate>
> > 		    		<map:transform
> > src="context:/historyserver/styles/searchresult.xsl"/>
> >     			    <map:serialize/>
> >     			</map:act>
> >     		</map:act>
> >
> > I can retrieve act2 messages f in the xsp but act1 messages are null. I
> > checked the action is returning parameters.
> >
> > If act1 fails I want to display an error message which is
> > different from the
> > message to be displayed when act2 fails. Since both the failure
> > are directed
> > to the same file is there a way I can find out if act1 or act2 failed and
> > depending on that print the error message.
> >
> >
> > Thanks,
> > Anna.
> >
> > On Monday 23 February 2004 01:01 pm, Anna Bikkina wrote:
> > > Hi,
> > >
> > > I am using multiple action classes to validate my date. I want
> >
> > to display
> >
> > > error message depending on which action class has failed. I am
> >
> > trying to do
> >
> > > something like this because that fails. Can someone suggest me
> >
> > how can I do
> >
> > > this.
> > >
> > > I am adding a parameter ERROR after every act and trying to use
> >
> > it in the
> >
> > > xsp and displaying it. I am not able to get it in the
> > > security.xsp.ERROR parameter is returning null. Can some suggest a
> > > working idea to solve my problem.
> > >
> > >     <map:match pattern="security.xsp">
> > >     	<map:act type="validator">
> > >     		<map:parameter name="descriptor"
> > > value="/usr/local/jboss/tomcat/webapps/
> > > cocoon/historyserver/styles/descriptor.xml"/>
> > >
> > >     		<map:act type="startdate" src="security.xsp">
> > > 			<map:parameter "ERROR"  value="Invalid start date"/>
> > >     		    	<map:act type="enddate" src="security.xsp">
> > > 				<map:parameter "ERROR"
> >
> > value="Invalid end date"/>
> >
> > >     		    	<map:act type="validateothers"
> >
> > src="security.xsp">
> >
> > > 				<map:parameter "ERROR"
> >
> > value="Invalid other data"/>
> >
> > >     		   		<map:act type="get-security">
> > >
> > > 		    		<map:generate type="serverpages"
> >
> > src="securityresult.xsp"/>
> >
> > > 		    		<map:transform src="search.xsl"/>
> > > 				     <map:serialize/>
> > >     			</map:act>
> > >     			</map:act>
> > >     			</map:act>
> > >     		</map:act>
> > >
> > >
> > >      <map:generate src="security.xsp" type="serverpages"/>
> > >
> > >
> > >      <map:transform src="search.xsl"/>
> > >
> > >      <map:serialize/>
> > >    </map:match>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
>
> ---------------------------------------------------------------------
> 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


AW: Actions and parameters in sitemap

Posted by Marco Rolappe <m_...@web.de>.
hi anna,

the <map:act> containers form kind of scopes. as illustrated by neil, you
have to reference variables from outer 'scopes' via a corresponding 'path'
expression. that whole issue is a bit... dunno. but that's one reason not to
use actions.

contrived example:

...
	<map:act type="act1"> <!-- returns a parameter 'foo' -->
		<map:act type="act2"> <!-- returns a parameter 'bar' -->
			<map:parameter name="foo" value="{foo}"/>

			<map:redirect-to uri="{../foo}{bar}"/>
		</map:act>
	</map:act>
...

an important one to note here is act2's parameter 'foo'; since it's a
parameter to act2 it's not in act2's 'scope', even though the placement of
the <map:parameter> might suggest so. thus the reference is {foo} and not
{../foo}; just think of it as a call from within act1's scope: act2(foo:
{foo})
this is in contrast to the <map:redirect-to>, which is inside act2's scope.
so you have to reference the parent scope for 'foo' and the current scope
for 'bar'.

regarding error flagging there are several possibilities; if you stay in the
same pipeline (no redirects, etc.) you can use request attributes. when
redirecting or similar you could pass an error code or message as request
parameter(s), e.g. <map:redirect-to uri="cocoon:/handle-my-err?fail=act1"/>.
the last resort would be setting a session attribute.

> -----Ursprüngliche Nachricht-----
> Von: users-return-63503-m_rolappe=web.de@cocoon.apache.org
> [mailto:users-return-63503-m_rolappe=web.de@cocoon.apache.org]Im Auftrag
> von Anna Bikkina
> Gesendet: Dienstag, 24. Februar 2004 23:38
> An: users@cocoon.apache.org
> Betreff: Re: Actions and parameters in sitemap
>
>
> Can someone please answer the below question.
>
> Also I have nested acts and when the 1st act sends parameters
> will they be
> replaced by the second acts parameters(key in the hashmap are
> different so I
> guess they cannot be replaced). But when I ampassing all these parameters
> (from act1 and act2) to the generator the latest act(act2) parameters are
> being sent the xsp the others (act1 return parameters are not
> being sent).
> Can you someone tell me if I am doing anything wrong.
>
>
> 		<map:act type="startdate" src="security.xsp">
>
>     		   		<map:act type="get-security">
>
> 		    		<map:generate type="serverpages"
> src="securityresult.xsp">
> 		    			<map:parameter
> name="act2msg1" value="{sec_shortname}"/>
> 		    			<map:parameter
> name="act2msg2" value="{sec_piggyback}"/>
> 		    			<map:parameter
> name="act1msg1" value="{startdate}"/>
> 		    			<map:parameter
> name="act1msg2" value="{enddate}"/>
> 		    		</map:generate>
> 		    		<map:transform
> src="context:/historyserver/styles/searchresult.xsl"/>
>     			    <map:serialize/>
>     			</map:act>
>     		</map:act>
>
> I can retrieve act2 messages f in the xsp but act1 messages are null. I
> checked the action is returning parameters.
>
> If act1 fails I want to display an error message which is
> different from the
> message to be displayed when act2 fails. Since both the failure
> are directed
> to the same file is there a way I can find out if act1 or act2 failed and
> depending on that print the error message.
>
>
> Thanks,
> Anna.
>
>
>
> On Monday 23 February 2004 01:01 pm, Anna Bikkina wrote:
> > Hi,
> >
> > I am using multiple action classes to validate my date. I want
> to display
> > error message depending on which action class has failed. I am
> trying to do
> > something like this because that fails. Can someone suggest me
> how can I do
> > this.
> >
> > I am adding a parameter ERROR after every act and trying to use
> it in the
> > xsp and displaying it. I am not able to get it in the security.xsp.ERROR
> > parameter is returning null. Can some suggest a working idea to solve my
> > problem.
> >
> >     <map:match pattern="security.xsp">
> >     	<map:act type="validator">
> >     		<map:parameter name="descriptor"
> > value="/usr/local/jboss/tomcat/webapps/
> > cocoon/historyserver/styles/descriptor.xml"/>
> >
> >     		<map:act type="startdate" src="security.xsp">
> > 			<map:parameter "ERROR"  value="Invalid start date"/>
> >     		    	<map:act type="enddate" src="security.xsp">
> > 				<map:parameter "ERROR"
> value="Invalid end date"/>
> >     		    	<map:act type="validateothers"
> src="security.xsp">
> > 				<map:parameter "ERROR"
> value="Invalid other data"/>
> >     		   		<map:act type="get-security">
> >
> > 		    		<map:generate type="serverpages"
> src="securityresult.xsp"/>
> > 		    		<map:transform src="search.xsl"/>
> > 				     <map:serialize/>
> >     			</map:act>
> >     			</map:act>
> >     			</map:act>
> >     		</map:act>
> >
> >
> >      <map:generate src="security.xsp" type="serverpages"/>
> >
> >
> >      <map:transform src="search.xsl"/>
> >
> >      <map:serialize/>
> >    </map:match>
> >
> >
> > ---------------------------------------------------------------------
> > 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
>


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


RE: Actions and parameters in sitemap

Posted by Neil Bacon <nb...@pinnaclesoftware.com.au>.
Try
  <map:parameter name="act1msg1" value="{../startdate}"/>
  <map:parameter name="act1msg2" value="{../enddate}"/>

Cheers,
	Neil.
-----Original Message-----
From: users-return-63503-nbacon=aisoftware.com.au@cocoon.apache.org
[mailto:users-return-63503-nbacon=aisoftware.com.au@cocoon.apache.org]On
Behalf Of Anna Bikkina
Sent: Wednesday, 25 February 2004 9:38 AM
To: users@cocoon.apache.org
Subject: Re: Actions and parameters in sitemap


Can someone please answer the below question.

Also I have nested acts and when the 1st act sends parameters will they be
replaced by the second acts parameters(key in the hashmap are different so I
guess they cannot be replaced). But when I ampassing all these parameters
(from act1 and act2) to the generator the latest act(act2) parameters are
being sent the xsp the others (act1 return parameters are not being sent).
Can you someone tell me if I am doing anything wrong.


		<map:act type="startdate" src="security.xsp">
    		   		<map:act type="get-security">
		    		<map:generate type="serverpages" src="securityresult.xsp">
		    			<map:parameter name="act2msg1" value="{sec_shortname}"/>
		    			<map:parameter name="act2msg2" value="{sec_piggyback}"/>
		    			<map:parameter name="act1msg1" value="{startdate}"/>
		    			<map:parameter name="act1msg2" value="{enddate}"/>
		    		</map:generate>
		    		<map:transform
src="context:/historyserver/styles/searchresult.xsl"/>
    			    <map:serialize/>
    			</map:act>
    		</map:act>

I can retrieve act2 messages f in the xsp but act1 messages are null. I
checked the action is returning parameters.

If act1 fails I want to display an error message which is different from the
message to be displayed when act2 fails. Since both the failure are directed
to the same file is there a way I can find out if act1 or act2 failed and
depending on that print the error message.


Thanks,
Anna.



On Monday 23 February 2004 01:01 pm, Anna Bikkina wrote:
> Hi,
>
> I am using multiple action classes to validate my date. I want to display
> error message depending on which action class has failed. I am trying to
do
> something like this because that fails. Can someone suggest me how can I
do
> this.
>
> I am adding a parameter ERROR after every act and trying to use it in the
> xsp and displaying it. I am not able to get it in the security.xsp.ERROR
> parameter is returning null. Can some suggest a working idea to solve my
> problem.
>
>     <map:match pattern="security.xsp">
>     	<map:act type="validator">
>     		<map:parameter name="descriptor"
> value="/usr/local/jboss/tomcat/webapps/
> cocoon/historyserver/styles/descriptor.xml"/>
>
>     		<map:act type="startdate" src="security.xsp">
> 			<map:parameter "ERROR"  value="Invalid start date"/>
>     		    	<map:act type="enddate" src="security.xsp">
> 				<map:parameter "ERROR"  value="Invalid end date"/>
>     		    	<map:act type="validateothers" src="security.xsp">
> 				<map:parameter "ERROR"  value="Invalid other data"/>
>     		   		<map:act type="get-security">
>
> 		    		<map:generate type="serverpages" src="securityresult.xsp"/>
> 		    		<map:transform src="search.xsl"/>
> 				     <map:serialize/>
>     			</map:act>
>     			</map:act>
>     			</map:act>
>     		</map:act>
>
>
>      <map:generate src="security.xsp" type="serverpages"/>
>
>
>      <map:transform src="search.xsl"/>
>
>      <map:serialize/>
>    </map:match>
>
>
> ---------------------------------------------------------------------
> 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



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


Re: Actions and parameters in sitemap

Posted by Anna Bikkina <an...@pinksheets.com>.
Can someone please answer the below question.

Also I have nested acts and when the 1st act sends parameters will they be 
replaced by the second acts parameters(key in the hashmap are different so I 
guess they cannot be replaced). But when I ampassing all these parameters 
(from act1 and act2) to the generator the latest act(act2) parameters are 
being sent the xsp the others (act1 return parameters are not being sent). 
Can you someone tell me if I am doing anything wrong.


		<map:act type="startdate" src="security.xsp">   		    	
    		   		<map:act type="get-security">    		   			
		    		<map:generate type="serverpages" src="securityresult.xsp">
		    			<map:parameter name="act2msg1" value="{sec_shortname}"/>
		    			<map:parameter name="act2msg2" value="{sec_piggyback}"/>
		    			<map:parameter name="act1msg1" value="{startdate}"/>
		    			<map:parameter name="act1msg2" value="{enddate}"/>
		    		</map:generate>		    			
		    		<map:transform src="context:/historyserver/styles/searchresult.xsl"/>     
    			    <map:serialize/>    
    			</map:act>    			
    		</map:act>

I can retrieve act2 messages f in the xsp but act1 messages are null. I 
checked the action is returning parameters.

If act1 fails I want to display an error message which is different from the 
message to be displayed when act2 fails. Since both the failure are directed 
to the same file is there a way I can find out if act1 or act2 failed and 
depending on that print the error message.


Thanks,
Anna.



On Monday 23 February 2004 01:01 pm, Anna Bikkina wrote:
> Hi,
>
> I am using multiple action classes to validate my date. I want to display
> error message depending on which action class has failed. I am trying to do
> something like this because that fails. Can someone suggest me how can I do
> this.
>
> I am adding a parameter ERROR after every act and trying to use it in the
> xsp and displaying it. I am not able to get it in the security.xsp.ERROR
> parameter is returning null. Can some suggest a working idea to solve my
> problem.
>
>     <map:match pattern="security.xsp">
>     	<map:act type="validator">
>     		<map:parameter name="descriptor"
> value="/usr/local/jboss/tomcat/webapps/
> cocoon/historyserver/styles/descriptor.xml"/>
>
>     		<map:act type="startdate" src="security.xsp">
> 			<map:parameter "ERROR"  value="Invalid start date"/>
>     		    	<map:act type="enddate" src="security.xsp">
> 				<map:parameter "ERROR"  value="Invalid end date"/>
>     		    	<map:act type="validateothers" src="security.xsp">
> 				<map:parameter "ERROR"  value="Invalid other data"/>
>     		   		<map:act type="get-security">
>
> 		    		<map:generate type="serverpages" src="securityresult.xsp"/>
> 		    		<map:transform src="search.xsl"/>
> 				     <map:serialize/>
>     			</map:act>
>     			</map:act>
>     			</map:act>
>     		</map:act>
>
>
>      <map:generate src="security.xsp" type="serverpages"/>
>
>
>      <map:transform src="search.xsl"/>
>
>      <map:serialize/>
>    </map:match>
>
>
> ---------------------------------------------------------------------
> 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