cppcms::form から継承するクラスを使用せずに、純粋な html ファイルから POST フィールドを取得する方法を知りたいです。たとえば、次のクラスを実装するクラスが必要です。
std::string Index::main(const std::string &url, const std::map<std::string, std::string> parameters)
{
std::string out = (
"<html>\n"
"<body>\n"
"<form name='test' action='' method='post'>"
"<h1>Hello, put your name here:</h1><br />"
"<input type='text' name='user'>"
"<input type='submit' value='Submit'>"
"</form>"
"</body>\n"
"</html>\n"
);
return out;
}
このメソッドは、cppcms::application を継承するクラスで呼び出されます。
void Engine::main(const std::string &url)
{
std::map<std::string, std::string> params;
pages["/"] = boost::bind(&Index::main, boost::shared_ptr<Index>(new Index), _1, _2);
std::string out = pages[url](url, params); // Call to Index::main
response().out() << out;
}
私がしたいのは、「user」フィールドを取得して「params」マップに配置することです。Index クラスを cppcms::form から継承させたり、「post」内で「get」メソッドを使用したりする必要はありません。私は、html ファイル/クラスを cppcms フレームワークから完全に独立させたいと考えています。出来ますか?ありがとうございました。