On 6/5/06, Gurram, Srinivas <[EMAIL PROTECTED]> wrote:
Thanks for reply.
Actually i am passing two parameters into that action pipeline for one
of my publication. but those parameters are not necessary for other
publications.
when i am trying to create a new document in other publications, its giving an
error "parameter exception".so, how can i pass those parameters basing on
publication in usecase.xmap.
Sorry about the delay. I just noticed your issue was not solved.
There is an algorithm called "setting a default value". It is not
used much in Lenya1.2 because the devs prefer to throw errors if input
is not perfect, but it is extremely useful for programs used by the
general public. The code looks like:
name = "Name left blank";
testname = cocoon.parameter.name;
if((null != testname) && (name.length() > 0) name = testname; //Valid input
It can also be done in reverse:
name = cocoon.parameter.name;
if((null != name) && (name.length() < 1) name = "Name left blank";
//Invalid input
You could also set the invalid parameter to empty or null, and then
test before any publication-specific code that would use it.
if(!name.equals("Name left blank")) doSomething;
or only throw an error if the parameter was required:
if(publication.equals("mypub") && name.equals("Name left blank"))
throw error;
Java has a special syntax for catching errors. Use it if you are
receiving an error when retrieving the parameter:
try{
name = cocoon.parameter.name;
}catch(ParameterException pe){
name = "No name parameter found";
}
You might hire a Java programmer to assist with this.
solprovider
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]