[EMAIL PROTECTED] wrote:
>I don't understand how actions can read fields from an html form through the sitemap.
>I have a
>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">
> <b>Search</b>
> <input size="25" maxlength="100" name="search_string" type="text">
> <input value="..." name="cocoon-action-Search" type="submit">
></form>
>
>
>in my Sitemap:
><map:actions>
> <map:action name="Search" src="Search"/>
></map:actions>
>
><map:match pattern="search_*.html">
> <map:act type="Search">
> <map:generate src="{proper_string}.xml"/>
> </map:act>
> <map:transform src="stylesheets/main.xsl"/>
> <map:serialize/>
></map:match>
>
>
>
>
>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"));
>
Who populated the attribute? (Hint: nobody, thus no value)
Do you really want getParameter here instead of attribute? (Hint: yes,
you really want getParameter here).
Vadim
> return sitemapParams;
> }
>
>}
>
>
---------------------------------------------------------------------
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]>