Re: [Cppcms-users] query string
Brought to you by:
artyom-beilis
From: mawan s. <ma...@gm...> - 2015-09-30 07:54:56
|
How good practice about to get paramters from query string (GET method , and not from POST method)? Thanks On Wed, Sep 30, 2015 at 2:42 PM, kpeo <sla...@ya...> wrote: > Hi! > > You can get raw post data from request (let's assume cppcms::application& > app_;) in your application (below). > (see: > http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html) > <http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html> > > But it's not seems like a good practice, because CppCMS have built-in > forms/widgets classes - see: > http://cppcms.com/wikipp/en/page/cppcms_1x_forms > <http://cppcms.com/wikipp/en/page/ref_cppcms_forms> > http://cppcms.com/wikipp/en/page/ref_cppcms_forms > AFAIK values are the same, but by using CppCMS classes you have additional > compile-time type checking, usefull functional, etc. > > virtual void post(content::my_content& c) > > { > cppcms::http::request& req = app_.request(); > if (req.request_method()=="POST") { > std::pair<void *,size_t> post_data = req.raw_post_data(); > std::istringstream ss(std::string(reinterpret_cast<char const > *>(post_data.first),post_data.second)); > //BOOSTER_LOG(debug,__FUNCTION__) << "raw post data: " << ss.str(); > > // Get some submitted values > > if(!req.post("check").empty()) //get some hidden input value for form > with name "check" > { > std::string name = req.post("name"); //get value of input with name > "name" > > // Some handler > > } > } > > Best regards, > kpeo > 30.09.2015, 10:06, "mawan sugiyanto" <ma...@gm...>: > > Dear All > > is there any method from request object to get querystring value? > is it similar with value from form (using load content)? > > Thanks > , > > > ------------------------------------------------------------------------------ > , > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |