cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Steuck <g...@buildpoint.com>
Subject sitemap to xsp map:parameters passing
Date Thu, 27 Sep 2001 20:20:37 GMT
Hello,

Thank you for creating such an elegant and versatile product. I am
learning it and have some questions. I would be very grateful if
somebody could help me out.

I'm using cocoon_20_branch as of today with java full version "J2RE
1.3.0 IBM build cx130-20010626" on RedHat 7.1. I'm having a problem
passing parameters from sitemap into an xsp. Here's the relevant
sitemap element:

<map:match pattern="docs/project_list">
  <map:generate type="serverpages" src="project_list.xsp">
    <map:parameter name="detail_page" value="edit_project"/>
  </map:generate>
  <map:transform src="stylesheets/simple-page2html.xsl"/>

  <map:serialize/>
</map:match>

Now in project_list.xsp, I'm trying to access this parameter as
presrcibed in http://xml.apache.org/cocoon2/matchers-selectors.html:

<detail_page>
<xsp:expr>parameters.getParameter("detail_page")</xsp:expr>
</detail_page>

Page won't compile now:

java.lang.reflect.InvocationTargetException: org.apache.cocoon.ProcessingException: Language
Exception: org.apache.cocoon.components.language.LanguageException: Error compiling project_list_xsp:
Line 462, column 61:  Exception org.apache.avalon.framework.parameters.ParameterException
must be caught, or it must be declared in the throws clause of this method.
	at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.createResource(ProgramGeneratorImpl.java:278)
	at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:225)
	at org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator.java:145)
	at org.apache.cocoon.components.pipeline.AbstractEventPipeline.setupPipeline(AbstractEventPipeline.java:146)
	at org.apache.cocoon.components.pipeline.CachingEventPipeline.setup(CachingEventPipeline.java:243)
	at org.apache.cocoon.components.pipeline.CachingEventPipeline.generateKey(CachingEventPipeline.java:103)
	at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:282)
	at org.apache.cocoon.www.greg.sitemap_xmap.resource_dynamic_page(sitemap_xmap.java:361)

Ok, knowing that there's xsp:logic, I'm building a catch block around
the offending parameters.getParameter:

<xsp:logic>
String detail_page = "BAD";
try {
   detail_page = parameters.getParameter("detail_page");
} catch (org.apache.avalon.framework.parameters.ParameterException e) {
  detail_page = "EXCEPTION";
  <para><xsp:expr>e.toString()</xsp:expr></para>
}
<detail_page><xsp:expr>detail_page</xsp:expr></detail_page>
</xsp:logic>

Now the page compiles, but execution yields:
org.apache.avalon.framework.parameters.ParameterException: The parameter 'detail_page' does
not contain a value

Am I completely misunderstanding the concept of parameter passing from
sitemap into xsp? Or is there a different way to pass data from
sitemap into xsp? I know that I can use request, but it seems to be
gross misuse of it and will have security implications too.

Thanks
Greg

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message