Sophia,

There are a number of solutions to this. I will name two:

1) Use a stateless form, take a look at the HTML (and form action) it
generates, and post to that form from an external site. I have not tested
this myself, but I expect it will work like a charm. Since the form is
stateless, it should always be handle a post, wherever it comes from

2) mount a custom handler on a URL and process the form fields manually.
This is a two-fold process:
- extend (e.g.) URIRequestTargetUrlCodingStrategy, and mount that @
application init
    - decode() is most important to you in this case, you should return an
instance of your IRequestTarget implementation here (see my next point)
- create a second class which implements IRequestTarget and handles the form
submit
    - in respond( RequestCycle ) you can access the HttpServlet through
       HttpServletRequest request = ( (WebRequest) requestCycle.getRequest()
).getHttpServletRequest();

Hope this helps.

Bas


NYSophia wrote:
> 
> Were you able to find a solution?
> 
> 
> LLehtinen wrote:
>> 
>> Hi -
>> 
>> I have "normal" POST requests coming from an external website. I would 
>> like to have a model object's members populated with the matching HTTP 
>> parameter values sent in the request. I have a feeling that there is an 
>> obvious an elegant way of having Wicket do this for me, but I can't seem 
>> to figure it out at this late hour. I would appreciate it if someone 
>> could point me to the right direction!
>> 
>> Right now I'm depending on a bunch of getRequest().getParameter() calls 
>> which seems way too servlet-ish to be the "right" way of doing this.
>> 
>> For clarity:
>> 
>> Let's say the incoming POST request contains the following parameters: 
>> id and name.
>> 
>> I would like to have Wicket populate a POJO (a model object) like this 
>> for me:
>> 
>> public class ModelObject {
>>   private Long id;
>>   private String name;
>> 
>>   .. getters & setters ..
>> 
>> }
>> 
>> instead of doing
>> 
>> Long id = Long.parseLong(getRequest().getParameter("id"));
>> String name = getRequest().getParameter("name");
>> 
>> Thank you all for your quick responses to my earlier questions.
>> 
>> --
>> LL
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Populating-a-model-with-form-data-from-external-site-tp17395075p25001556.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to