cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject connecting form field to action
Date Mon, 19 Aug 2002 17:10:03 GMT
I don't understand how actions can read fields from an html form through the sitemap. I have
text field in a form, i'd like to pass that field's value to an action which will eventually
modify it and 
return it to the sitemap. My action, sitemap, form can see each other and execute properly,

however the text field is not passed to the action. Is there something special i have to do
to the 
sitemap in order for this to happen?
here is the code:

in my html:
<form action="search_1.html" method="post" name="Search_Form">
  <input size="25" maxlength="100" name="search_string" type="text">
  <input value="..." name="cocoon-action-Search" type="submit">

in my Sitemap:
     <map:action name="Search" src="Search"/>

<map:match pattern="search_*.html">
   <map:act type="Search">
      <map:generate src="{proper_string}.xml"/>
   <map:transform src="stylesheets/main.xsl"/>    

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

public class Search extends AbstractAction {
  public Map act (Redirector redirector, SourceResolver resolver, Map objectModel,
                  String source, Parameters params) {
    Request request = ObjectModelHelper.getRequest(objectModel);
    Map sitemapParams = new HashMap();
    sitemapParams.put("proper_string", request.getAttribute("search_string")); 

    return sitemapParams;


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

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message