You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Sparkes <pe...@didm.co.uk> on 2013/06/27 10:32:56 UTC

Selecting values from a html5 form

Hi,

I want to use a html5 form to pass values into my sitemap eg

     <form action="enquiry" method="?" >
         <input type="text" name="fromname"    placeholder="Your Name"   required=''/>

How do I pass "fromname" into "enquiry"

Regards

Peter

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


Re: Selecting values from a html5 form

Posted by Thorsten Scherler <sc...@gmail.com>.
On 07/04/2013 11:41 AM, Jos Snellings wrote:
> You are welcome :-)
>
>
> On Thu, Jul 4, 2013 at 10:55 AM, Peter Sparkes <peter@didm.co.uk
> <ma...@didm.co.uk>> wrote:
>
>     Hi Jos & Thorsten,
>
>     I am sorry that I have not thanked you before for your help.
>
>     Thank you again
>

Have not done anything, just a small tweek, so "de nada". ;)

salu2

-- 
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/


Re: Selecting values from a html5 form

Posted by Jos Snellings <jo...@upperware.biz>.
You are welcome :-)


On Thu, Jul 4, 2013 at 10:55 AM, Peter Sparkes <pe...@didm.co.uk> wrote:

>  Hi Jos & Thorsten,
>
> I am sorry that I have not thanked you before for your help.
>
> Thank you again
>
> Regards
>
> Peter
>
>
> On 27/06/2013 13:39, Thorsten Scherler wrote:
>
> On 06/27/2013 02:32 PM, Jos Snellings wrote:
>
> Hi Jos,
>
> nice post! Small enhancement see above.
>
>   Hi Peter,
>
>  In the sitemap you have access to request parameters via Jexl:
>
>
> <map:match pattern="enquiry">
>       <map:generate type="someGeneration">
>              <map:parameter name="from"
> value="{jexl:cocoon.request.parameter.fromname}"/>
>
>           ...
>
>
>  However, it may be far more convenient to use the HttpRequest, as it is
> exposed in different ways:
>
>  1. if you want to send your user's inputs to a controller to handle them
> as in:
>
>
>  <map:match pattern="enquiry">
>             <controller:call controller="rest-controller"
> select="some.package.EnquiryController">
>
>             </controller:call>
>         </map:match>
>
>  The http request is accessible by just declaring it with the annotation
> @Inject:
>
>    @Inject
>     private HttpServletRequest request;
>
>
> Here you can do directly
>
>     @RequestParameter
>     private String fromname;
>
> salu2
>
>
>  In your "doPost" method (or even doGet) you can use the request:
>
>  String fromName = request.getParameter("fromname");
>
>
>
>  Instead of sending the input to a controller, it may happen that there
> is little to control, and you just want to do a model generation as a
> response.
>  In that case:
>
>  if you are declaring:
> public class SomeViewGenerator extends AbstractSAXGenerator {
>
>  You may override the "setup" member :
>
>
> public void setup(Map<String, Object> parameters) {
> try {
>
>     request = HttpContextHelper.getRequest(parameters);
>
>
>  The setup member is just called at pipeline setup, and when this happens
> in a web application context, the http request is just one of the
> parameters.
>
>
>  I hope this little expose helps,
> Jos
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, Jun 27, 2013 at 10:32 AM, Peter Sparkes <pe...@didm.co.uk> wrote:
>
>> Hi,
>>
>> I want to use a html5 form to pass values into my sitemap eg
>>
>>     <form action="enquiry" method="?" >
>>         <input type="text" name="fromname"    placeholder="Your Name"
>> required=''/>
>>
>> How do I pass "fromname" into "enquiry"
>>
>> Regards
>>
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>
> --
> We should be careful to get out of an experience only the wisdom that is
> in it - and stay there, lest we be like the cat that sits down on a hot
> stove-lid.  She will never sit down on a hot stove-lid again - and that
> is well; but also she will never sit down on a cold one any more.
>         -- Mark Twain
>
>
>
> --
> Thorsten Scherler <scherler.at.gmail.com>
> codeBusters S.L. - web based systems
> <consulting, training and solutions>
> http://www.codebusters.es/
>
>
>


-- 
We should be careful to get out of an experience only the wisdom that is
in it - and stay there, lest we be like the cat that sits down on a hot
stove-lid.  She will never sit down on a hot stove-lid again - and that
is well; but also she will never sit down on a cold one any more.
        -- Mark Twain
 <http://www.brainyquote.com/quotes/quotes/t/thomashobb118630.html>

Re: Selecting values from a html5 form

Posted by Peter Sparkes <pe...@didm.co.uk>.
Hi Jos & Thorsten,

I am sorry that I have not thanked you before for your help.

Thank you again

Regards

Peter

On 27/06/2013 13:39, Thorsten Scherler wrote:
> On 06/27/2013 02:32 PM, Jos Snellings wrote:
>
> Hi Jos,
>
> nice post! Small enhancement see above.
>
>> Hi Peter,
>>
>> In the sitemap you have access to request parameters via Jexl:
>>
>>
>> <map:match pattern="enquiry">
>>       <map:generate type="someGeneration">
>>              <map:parameter name="from" value="{jexl:cocoon.request.parameter.fromname}"/>
>>
>>           ...
>>
>>
>> However, it may be far more convenient to use the HttpRequest, as it is exposed in different ways:
>>
>> 1. if you want to send your user's inputs to a controller to handle them as in:
>>
>>
>>  <map:match pattern="enquiry">
>>             <controller:call controller="rest-controller" select="some.package.EnquiryController">
>>
>>             </controller:call>
>>         </map:match>
>>
>> The http request is accessible by just declaring it with the annotation @Inject:
>>
>>    @Inject
>>     private HttpServletRequest request;
>>
>
> Here you can do directly
>
>     @RequestParameter
>     private String fromname;
>
> salu2
>
>>
>> In your "doPost" method (or even doGet) you can use the request:
>>
>> String fromName = request.getParameter("fromname");
>>
>>
>>
>> Instead of sending the input to a controller, it may happen that there is little to control, and 
>> you just want to do a model generation as a response.
>> In that case:
>>
>> if you are declaring:
>> public class SomeViewGenerator extends AbstractSAXGenerator {
>>
>> You may override the "setup" member :
>>
>>
>> public void setup(Map<String, Object> parameters) {
>> try {
>>
>>     request = HttpContextHelper.getRequest(parameters);
>>
>>
>> The setup member is just called at pipeline setup, and when this happens in a web application 
>> context, the http request is just one of the parameters.
>>
>>
>> I hope this little expose helps,
>> Jos
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Jun 27, 2013 at 10:32 AM, Peter Sparkes <peter@didm.co.uk <ma...@didm.co.uk>> wrote:
>>
>>     Hi,
>>
>>     I want to use a html5 form to pass values into my sitemap eg
>>
>>         <form action="enquiry" method="?" >
>>             <input type="text" name="fromname"  placeholder="Your Name"   required=''/>
>>
>>     How do I pass "fromname" into "enquiry"
>>
>>     Regards
>>
>>     Peter
>>
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>     <ma...@cocoon.apache.org>
>>     For additional commands, e-mail: users-help@cocoon.apache.org
>>     <ma...@cocoon.apache.org>
>>
>>
>>
>>
>> -- 
>> We should be careful to get out of an experience only the wisdom that is
>> in it - and stay there, lest we be like the cat that sits down on a hot
>> stove-lid.  She will never sit down on a hot stove-lid again - and that
>> is well; but also she will never sit down on a cold one any more.
>>         -- Mark Twain
>
>
> -- 
> Thorsten Scherler <scherler.at.gmail.com>
> codeBusters S.L. - web based systems
> <consulting, training and solutions>
>
> http://www.codebusters.es/


Re: Selecting values from a html5 form

Posted by Thorsten Scherler <sc...@gmail.com>.
On 06/27/2013 02:32 PM, Jos Snellings wrote:

Hi Jos,

nice post! Small enhancement see above.

> Hi Peter,
>
> In the sitemap you have access to request parameters via Jexl:
>
>
> <map:match pattern="enquiry">
>       <map:generate type="someGeneration">
>              <map:parameter name="from"
> value="{jexl:cocoon.request.parameter.fromname}"/>
>
>           ...
>
>
> However, it may be far more convenient to use the HttpRequest, as it
> is exposed in different ways:
>
> 1. if you want to send your user's inputs to a controller to handle
> them as in:
>
>
>  <map:match pattern="enquiry">
>             <controller:call controller="rest-controller"
> select="some.package.EnquiryController">
>               
>             </controller:call>
>         </map:match>
>
> The http request is accessible by just declaring it with the
> annotation @Inject:
>
>    @Inject
>     private HttpServletRequest request;
>

Here you can do directly

    @RequestParameter
    private String fromname;

salu2

>
> In your "doPost" method (or even doGet) you can use the request:
>
> String fromName = request.getParameter("fromname");
>
>
>
> Instead of sending the input to a controller, it may happen that there
> is little to control, and you just want to do a model generation as a
> response.
> In that case:
>
> if you are declaring:
> public class SomeViewGenerator extends AbstractSAXGenerator {
>
> You may override the "setup" member :
>
>
> public void setup(Map<String, Object> parameters) {
> try {
>
>     request = HttpContextHelper.getRequest(parameters);
>
>
> The setup member is just called at pipeline setup, and when this
> happens in a web application context, the http request is just one of
> the parameters.
>
>
> I hope this little expose helps,
> Jos
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, Jun 27, 2013 at 10:32 AM, Peter Sparkes <peter@didm.co.uk
> <ma...@didm.co.uk>> wrote:
>
>     Hi,
>
>     I want to use a html5 form to pass values into my sitemap eg
>
>         <form action="enquiry" method="?" >
>             <input type="text" name="fromname"    placeholder="Your
>     Name"   required=''/>
>
>     How do I pass "fromname" into "enquiry"
>
>     Regards
>
>     Peter
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>     For additional commands, e-mail: users-help@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>
>
>
>
> -- 
> We should be careful to get out of an experience only the wisdom that is
> in it - and stay there, lest we be like the cat that sits down on a hot
> stove-lid.  She will never sit down on a hot stove-lid again - and that
> is well; but also she will never sit down on a cold one any more.
>         -- Mark Twain


-- 
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/


Re: Selecting values from a html5 form

Posted by Jos Snellings <jo...@upperware.biz>.
Hi Peter,

In the sitemap you have access to request parameters via Jexl:


<map:match pattern="enquiry">
      <map:generate type="someGeneration">
             <map:parameter name="from"
value="{jexl:cocoon.request.parameter.fromname}"/>

          ...


However, it may be far more convenient to use the HttpRequest, as it is
exposed in different ways:

1. if you want to send your user's inputs to a controller to handle them as
in:


 <map:match pattern="enquiry">
            <controller:call controller="rest-controller"
select="some.package.EnquiryController">

            </controller:call>
        </map:match>

The http request is accessible by just declaring it with the annotation
@Inject:

   @Inject
    private HttpServletRequest request;



In your "doPost" method (or even doGet) you can use the request:

String fromName = request.getParameter("fromname");



Instead of sending the input to a controller, it may happen that there is
little to control, and you just want to do a model generation as a response.
In that case:

if you are declaring:
public class SomeViewGenerator extends AbstractSAXGenerator {

You may override the "setup" member :


public void setup(Map<String, Object> parameters) {
try {

    request = HttpContextHelper.getRequest(parameters);


The setup member is just called at pipeline setup, and when this happens in
a web application context, the http request is just one of the parameters.


I hope this little expose helps,
Jos













































On Thu, Jun 27, 2013 at 10:32 AM, Peter Sparkes <pe...@didm.co.uk> wrote:

> Hi,
>
> I want to use a html5 form to pass values into my sitemap eg
>
>     <form action="enquiry" method="?" >
>         <input type="text" name="fromname"    placeholder="Your Name"
> required=''/>
>
> How do I pass "fromname" into "enquiry"
>
> Regards
>
> Peter
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.**apache.org<us...@cocoon.apache.org>
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
We should be careful to get out of an experience only the wisdom that is
in it - and stay there, lest we be like the cat that sits down on a hot
stove-lid.  She will never sit down on a hot stove-lid again - and that
is well; but also she will never sit down on a cold one any more.
        -- Mark Twain
 <http://www.brainyquote.com/quotes/quotes/t/thomashobb118630.html>