Re: Using an action correctly?

2003-01-29 Thread Konstantin Piroumian
From: "Andres, Judith" <[EMAIL PROTECTED]>
...
should read:
// Now choose the suitable XSL for the output
if(report_id.equals("16"))
  results.put("result","report_16");

KP> results.put("results","report_16");
KP> --^
KP> "results" and not "result", to be exact.
KP>
KP>-- Konstantin


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




RE: Using an action correctly?

2003-01-29 Thread Geoff Howard
i've confused you on the use of the hash map.  i corrected the code below
with what you need .  they hashmap key name is arbitrary notice i've changed
it in your code and your sitemap.  Hopefully the fixed code will make what
needs to happen clear, but if not I can explain in more detail later.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 10:00 AM
> To: [EMAIL PROTECTED]
> Subject: Using an action correctly?
>
>
> Hi,
>
> I have written an action and compiled it successfully. I put it in the
> cocoon/WEB-INF/lib folder as a jar:
>
> package test.acting;
>
> import java.util.Map;
> import java.util.HashMap;
> import org.apache.avalon.framework.parameters.Parameters;
> import org.apache.cocoon.acting.AbstractAction;
> import org.apache.cocoon.environment.Request;
> import org.apache.cocoon.environment.SourceResolver;
> import org.apache.cocoon.environment.Redirector;
> import org.apache.cocoon.environment.ObjectModelHelper;
> import org.xml.sax.EntityResolver;
>
>
> public class XslSelection extends AbstractAction {
>
>   public Map act(Redirector redirector, SourceResolver resolver, Map
> objectModel,
>   String source, Parameters parameters){
>
> Map results = new HashMap();
> Request request = ObjectModelHelper.getRequest(objectModel);
>
> String report_id = request.getParameter("report_id");
> String service_id = request.getParameter("service_id");
>
> // Now choose the suitable XSL for the output
> if(report_id.equals("16"))
-->   results.put("xsl-choice","report_16");
> else if(report_id.equals("17") && service_id.equals("GSM"))
-->   results.put("xsl-choice","report_17GSM");
> else if(report_id.equals("17") && !service_id.equals("GSM"))
-->   results.put("xsl-choice","report_17");
> else if(report_id.equals("19"))
-->   results.put("xsl-choice","report_19");
> else if(report_id.equals("18"))
-->   results.put("xsl-choice","report_18");
> else
-->   results.put("xsl-choice","error");
>
> return results;
>   }
> }
>
>
> In the sitemap I "import" it as follows.
>  ...
> 
>   
>   
> ...
> 
>
>
> Thats how I use it in the sitemap:
> ...
> 
> 
> 
-->
>
> 
>  
> ...
>
> But I only get the error that cocoon can't find the page (Resource not
> found). Invoking the different stylesheets "manually" is no problem, but
> using the action.
> Since it is my first action, I don't know where to look for the error.
>
> Another question. Can't I just give back a String? My XSLs are called
> report_16.xsl, report_17.xsl, report_18.xsl, report_19.xsl, error.xsl
>
> Jonny
>
> --
> --
>
> This electronic message contains information from the mmo2 plc Group which
> may be
> privileged or confidential. The information is intended to be for the use
> of the
> individual(s) or entity named above. If you are not the intended recipient
> be aware
> that any disclosure, copying, distribution or use of the contents of this
> information
> is prohibited. If you have received this electronic message in error,
> please notify
> us by telephone or email (to the numbers or address above) immediately.
>
>
>
>
> -
> 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: <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>
>


-
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: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




AW: Using an action correctly?

2003-01-29 Thread Andres, Judith
Hi Johannes,

This part of your action:
// Now choose the suitable XSL for the output
if(report_id.equals("16"))
  results.put("report_16","report_16");
else if(report_id.equals("17") && service_id.equals("GSM"))
  results.put("report_17GSM","report_17GSM");
else if(report_id.equals("17") && !service_id.equals("GSM"))
  results.put("report_17","report_17");
else if(report_id.equals("19"))
  results.put("report_19","report_19");
else if(report_id.equals("18"))
  results.put("report_18","report_18");
else
  results.put("error","error");

should read:
// Now choose the suitable XSL for the output
if(report_id.equals("16"))
  results.put("result","report_16");
else if(report_id.equals("17") && service_id.equals("GSM"))
  results.put("result","report_17GSM");
else if(report_id.equals("17") && !service_id.equals("GSM"))
  results.put("result","report_17");
else if(report_id.equals("19"))
  results.put("result","report_19");
else if(report_id.equals("18"))
  results.put("result","report_18");
else
  results.put("error","error");

In the sitemap you can refer to the keys in the Map you return but not to the variable 
name of that Map in your Action.

HTH
Judith

> -Ursprüngliche Nachricht-
> Von:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Gesendet am:  Mittwoch, 29. Januar 2003 16:00
> An:   [EMAIL PROTECTED]
> Betreff:  Using an action correctly?
> 
> Hi,
> 
> I have written an action and compiled it successfully. I put it in the
> cocoon/WEB-INF/lib folder as a jar:
> 
> package test.acting;
> 
> import java.util.Map;
> import java.util.HashMap;
> import org.apache.avalon.framework.parameters.Parameters;
> import org.apache.cocoon.acting.AbstractAction;
> import org.apache.cocoon.environment.Request;
> import org.apache.cocoon.environment.SourceResolver;
> import org.apache.cocoon.environment.Redirector;
> import org.apache.cocoon.environment.ObjectModelHelper;
> import org.xml.sax.EntityResolver;
> 
> 
> public class XslSelection extends AbstractAction {
> 
>   public Map act(Redirector redirector, SourceResolver resolver, Map
> objectModel,
>   String source, Parameters parameters){
> 
> Map results = new HashMap();
> Request request = ObjectModelHelper.getRequest(objectModel);
> 
> String report_id = request.getParameter("report_id");
> String service_id = request.getParameter("service_id");
> 
> // Now choose the suitable XSL for the output
> if(report_id.equals("16"))
>   results.put("report_16","report_16");
> else if(report_id.equals("17") && service_id.equals("GSM"))
>   results.put("report_17GSM","report_17GSM");
> else if(report_id.equals("17") && !service_id.equals("GSM"))
>   results.put("report_17","report_17");
> else if(report_id.equals("19"))
>   results.put("report_19","report_19");
> else if(report_id.equals("18"))
>   results.put("report_18","report_18");
> else
>   results.put("error","error");
> 
> return results;
>   }
> }
> 
> 
> In the sitemap I "import" it as follows.
>  ...
> 
>   
>   
> ...
> 
> 
> 
> Thats how I use it in the sitemap:
> ...
> 
> 
> 
>
>
> 
>  
> ...
> 
> But I only get the error that cocoon can't find the page (Resource not
> found). Invoking the different stylesheets "manually" is no problem, but> 
> using the action.
> Since it is my first action, I don't know where to look for the error.
> 
> Another question. Can't I just give back a String? My XSLs are called
> report_16.xsl, report_17.xsl, report_18.xsl, report_19.xsl, error.xsl
> 
> Jonny
> 
> 
>
> 
> This elec

Re: Using an action correctly?

2003-01-29 Thread Konstantin Piroumian
From: <[EMAIL PROTECTED]>

> Hi,
>
>
> Thats how I use it in the sitemap:
> ...
> 
> 
> 
>
>
> 
>  

Try to change this like below:

 
 



 
  

--
  Konstantin

> ...
>
> But I only get the error that cocoon can't find the page (Resource not
> found). Invoking the different stylesheets "manually" is no problem, but
> using the action.
> Since it is my first action, I don't know where to look for the error.
>
> Another question. Can't I just give back a String? My XSLs are called
> report_16.xsl, report_17.xsl, report_18.xsl, report_19.xsl, error.xsl
>
> Jonny
>
> --
--
>
> This electronic message contains information from the mmo2 plc Group which
> may be
> privileged or confidential. The information is intended to be for the use
> of the
> individual(s) or entity named above. If you are not the intended recipient
> be aware
> that any disclosure, copying, distribution or use of the contents of this
> information
> is prohibited. If you have received this electronic message in error,
> please notify
> us by telephone or email (to the numbers or address above) immediately.
>
>
>
>
> -
> Please check that your question  has not already been answered in the
> FAQ before posting. 
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Using an action correctly?

2003-01-29 Thread Johannes . Becker
Hi,

I have written an action and compiled it successfully. I put it in the
cocoon/WEB-INF/lib folder as a jar:

package test.acting;

import java.util.Map;
import java.util.HashMap;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.acting.AbstractAction;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.xml.sax.EntityResolver;


public class XslSelection extends AbstractAction {

  public Map act(Redirector redirector, SourceResolver resolver, Map
objectModel,
  String source, Parameters parameters){

Map results = new HashMap();
Request request = ObjectModelHelper.getRequest(objectModel);

String report_id = request.getParameter("report_id");
String service_id = request.getParameter("service_id");

// Now choose the suitable XSL for the output
if(report_id.equals("16"))
  results.put("report_16","report_16");
else if(report_id.equals("17") && service_id.equals("GSM"))
  results.put("report_17GSM","report_17GSM");
else if(report_id.equals("17") && !service_id.equals("GSM"))
  results.put("report_17","report_17");
else if(report_id.equals("19"))
  results.put("report_19","report_19");
else if(report_id.equals("18"))
  results.put("report_18","report_18");
else
  results.put("error","error");

return results;
  }
}


In the sitemap I "import" it as follows.
 ...

  
  
...



Thats how I use it in the sitemap:
...



   
   

 
...

But I only get the error that cocoon can't find the page (Resource not
found). Invoking the different stylesheets "manually" is no problem, but
using the action.
Since it is my first action, I don't know where to look for the error.

Another question. Can't I just give back a String? My XSLs are called
report_16.xsl, report_17.xsl, report_18.xsl, report_19.xsl, error.xsl

Jonny



This electronic message contains information from the mmo2 plc Group which
may be
privileged or confidential. The information is intended to be for the use
of the
individual(s) or entity named above. If you are not the intended recipient
be aware
that any disclosure, copying, distribution or use of the contents of this
information
is prohibited. If you have received this electronic message in error,
please notify
us by telephone or email (to the numbers or address above) immediately.




-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>