You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kenny Chow <ky...@yahoo.com> on 2002/08/16 14:05:48 UTC
[Q]getting values from action
Hi all,
I am running in a difficulty where I can't get a
value from an action. 'myAction' will define a key
called 'myParam' and return its value via the Map
object. Now myURL.xsp, in turn, tries to get the param
from the sitemap (see below); the param contains null.
I have tried creating a session in the action,
still null that the xsp gets. Any suggestion?
<map:match pattern="myURL">
<map:act type="myAction">
<map:parameter name="param" value="value" />
<map:generate src="xsp/myURL.xsp"
type="serverpages">
<map:parameter name="myParam" value="{myParam}"/>
</map:generate>
<map:serialize/>
</map:act>
</map:match>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: [Q]getting values from action
Posted by KOZLOV Roman <r-...@opencascade.com>.
Hi,
try {../myParam}.
Roman
Kenny Chow wrote:
> Hi all,
> I am running in a difficulty where I can't get a
> value from an action. 'myAction' will define a key
> called 'myParam' and return its value via the Map
> object. Now myURL.xsp, in turn, tries to get the param
> from the sitemap (see below); the param contains null.
>
> I have tried creating a session in the action,
> still null that the xsp gets. Any suggestion?
>
> <map:match pattern="myURL">
> <map:act type="myAction">
> <map:parameter name="param" value="value" />
> <map:generate src="xsp/myURL.xsp"
> type="serverpages">
> <map:parameter name="myParam" value="{myParam}"/>
> </map:generate>
> <map:serialize/>
> </map:act>
> </map:match>
>
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Summary:getting values from action
Posted by Kenny Chow <ky...@yahoo.com>.
Yes. Just noticed that map.put(key, value) was
mistakenly placed. But let me do a summary of my
problem anyhow.
==========================================
Problem: get parameters from action in xsp
Context: Suppose you have an action and it returns
parameters via its map object; and an xsp will get
them from the sitemap. Here is an example
sitemap begins
======================================
<map:match pattern="myURL">
<map:act type="myAction">
<map:generate src="xsp/myURL.xsp" type="serverpages">
<map:parameter name="myParam" value="{myParam}"/>
</map:generate>
</map:act>
</map:match>
======================================
action here
======================================
public class actionExample extends AbstractAction
implements ThreadSafe {
public Map act(...) throws Exception
Map map = new Hashmap();
/* do what you desire*/
....
map.put("myParam", myValue);
return map;
}
}
myURL.xsp
======================================
<?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsp-response="http://apache.org/xsp/response/2.0">
<page>
<title>someTitle</title>
<content>
<xsp:logic>
String myValue = null;
try {
myValue = parameters.getParameter("myParam");
}
catch(Exception e){}
</xsp:logic>
<para><xsp:expr>file</xsp:expr></para>
</page>
</xsp:page>
====================================
Kenny
--- Vadim Gritsenko <va...@verizon.net>
wrote:
>
> May be something is wrong with the action.
>
> Vadim
>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: [Q]getting values from action
Posted by Vadim Gritsenko <va...@verizon.net>.
Kenny Chow wrote:
>I use parameters.getParameter("myParam") in the xsp.
>'myParam' doesn't show up in sitemap.log.
>
>
May be something is wrong with the action.
Vadim
>Thanks KOZLOV.
>
>{../myParam} unfortunately doesn't work either.
>
>
>--- Vadim Gritsenko <va...@verizon.net>
>wrote:
>
>
>>Kenny Chow wrote:
>>
>>
>>
>>>Hi all,
>>> I am running in a difficulty where I can't get
>>>
>>>
>>a
>>
>>
>>>value from an action. 'myAction' will define a key
>>>called 'myParam' and return its value via the Map
>>>object. Now myURL.xsp, in turn, tries to get the
>>>
>>>
>>> param from the sitemap (see below);
>>
>>You did not tell how XSP gets this parameter. Also,
>>see sitemap.log file
>>('Current Sitemap Parameters'), chech that 'myParam'
>>shows up in there.
>>
>>Vadim
>>
>>
>>
>>
>>>the param contains null.
>>>
>>> I have tried creating a session in the action,
>>>still null that the xsp gets. Any suggestion?
>>>
>>><map:match pattern="myURL">
>>><map:act type="myAction">
>>> <map:parameter name="param" value="value" />
>>> <map:generate src="xsp/myURL.xsp"
>>>type="serverpages">
>>> <map:parameter name="myParam"
>>>
>>>
>>value="{myParam}"/>
>>
>>
>>> </map:generate>
>>> <map:serialize/>
>>> </map:act>
>>></map:match>
>>>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: [Q]getting values from action
Posted by Kenny Chow <ky...@yahoo.com>.
I use parameters.getParameter("myParam") in the xsp.
'myParam' doesn't show up in sitemap.log.
Thanks KOZLOV.
{../myParam} unfortunately doesn't work either.
--- Vadim Gritsenko <va...@verizon.net>
wrote:
> Kenny Chow wrote:
>
> >Hi all,
> > I am running in a difficulty where I can't get
> a
> >value from an action. 'myAction' will define a key
> >called 'myParam' and return its value via the Map
> >object. Now myURL.xsp, in turn, tries to get the
> param
> >from the sitemap (see below);
> >
>
> You did not tell how XSP gets this parameter. Also,
> see sitemap.log file
> ('Current Sitemap Parameters'), chech that 'myParam'
> shows up in there.
>
> Vadim
>
>
> > the param contains null.
> >
> > I have tried creating a session in the action,
> >still null that the xsp gets. Any suggestion?
> >
> ><map:match pattern="myURL">
> > <map:act type="myAction">
> > <map:parameter name="param" value="value" />
> > <map:generate src="xsp/myURL.xsp"
> >type="serverpages">
> > <map:parameter name="myParam"
> value="{myParam}"/>
> > </map:generate>
> > <map:serialize/>
> > </map:act>
> ></map:match>
> >
> >
>
>
>
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: [Q]getting values from action
Posted by Vadim Gritsenko <va...@verizon.net>.
Kenny Chow wrote:
>Hi all,
> I am running in a difficulty where I can't get a
>value from an action. 'myAction' will define a key
>called 'myParam' and return its value via the Map
>object. Now myURL.xsp, in turn, tries to get the param
>from the sitemap (see below);
>
You did not tell how XSP gets this parameter. Also, see sitemap.log file
('Current Sitemap Parameters'), chech that 'myParam' shows up in there.
Vadim
> the param contains null.
>
> I have tried creating a session in the action,
>still null that the xsp gets. Any suggestion?
>
><map:match pattern="myURL">
> <map:act type="myAction">
> <map:parameter name="param" value="value" />
> <map:generate src="xsp/myURL.xsp"
>type="serverpages">
> <map:parameter name="myParam" value="{myParam}"/>
> </map:generate>
> <map:serialize/>
> </map:act>
></map:match>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>