POST 请求:textarea 的名称值对是什么?
我正在尝试将 Android 中的某些内容提交到我无法控制的 Web 服务器。
它抱怨我没有发布正确的值。
我正在提交所有隐藏的输入名称和值对。
看着表格,我想知道我是否发布了错误的名称/值对。
我发布它的名称,“wr_content”作为名称,值作为我要发布的文本。
我在这里错过了什么吗?
这是 POST 请求的 HTML 代码:
<form name="fviewcomment" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off" style="margin:0px;">
<input type=hidden name=w id=w value='c'>
<input type=hidden name=bo_table value='specup'>
<input type=hidden name=wr_id value='337877'>
<input type=hidden name=comment_id id='comment_id' value=''>
<input type=hidden name=sca value='' >
<input type=hidden name=sfl value='' >
<input type=hidden name=stx value=''>
<input type=hidden name=spt value=''>
<input type=hidden name=page value='6'>
<input type=hidden name=cwin value=''>
<table width=650 align=center cellpadding=3 cellspacing=0 bgcolor=#FFFFFF style="border:1px solid #DFDFDF;">
<tr><td colspan="2" style="padding:1px 0 0 5px;"></td></tr>
<tr>
<td width="13%"><center>Veil</center></td>
<td width="80%">
<textarea id="wr_content" name="wr_content" rows="6" itemname="content" required
style='width:100%; word-break:break-all;' class=tx></textarea>
</td>
<td width=80 align=right><input type="image" src="../skin/board/jins_cate/img/btn_c_ok.gif" border=0 accesskey='s'></td></tr>
</table>
</form>
这是我的名称-值对:
List<NameValuePair> params2 = new ArrayList<NameValuePair>();
params2.add(new BasicNameValuePair("w", "c"));
params2.add(new BasicNameValuePair("bo_table", "specup")); //DYNAMIC
params2.add(new BasicNameValuePair("wr_id", "337877")); //DYNAMIC
params2.add(new BasicNameValuePair("comment_id", ""));
params2.add(new BasicNameValuePair("sca", ""));
params2.add(new BasicNameValuePair("sfl", ""));
params2.add(new BasicNameValuePair("stx", ""));
params2.add(new BasicNameValuePair("spt", ""));
params2.add(new BasicNameValuePair("page", "6")); //DYNAMIC
params2.add(new BasicNameValuePair("cwin", ""));
params2.add(new BasicNameValuePair("wr_content", "hello"));
I am trying to submit something in Android to Web Server I have no control over.
Its complaining that I didn't post with proper values.
I am submitting all hidden input name and value pairs.
Looking at the form, I am wondering if I am posting wrong name-value pair for .
I am posting its name, "wr_content" as name and value as text I want to post.
Am I missing something here?
Here's HTML code for POST request:
<form name="fviewcomment" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off" style="margin:0px;">
<input type=hidden name=w id=w value='c'>
<input type=hidden name=bo_table value='specup'>
<input type=hidden name=wr_id value='337877'>
<input type=hidden name=comment_id id='comment_id' value=''>
<input type=hidden name=sca value='' >
<input type=hidden name=sfl value='' >
<input type=hidden name=stx value=''>
<input type=hidden name=spt value=''>
<input type=hidden name=page value='6'>
<input type=hidden name=cwin value=''>
<table width=650 align=center cellpadding=3 cellspacing=0 bgcolor=#FFFFFF style="border:1px solid #DFDFDF;">
<tr><td colspan="2" style="padding:1px 0 0 5px;"></td></tr>
<tr>
<td width="13%"><center>Veil</center></td>
<td width="80%">
<textarea id="wr_content" name="wr_content" rows="6" itemname="content" required
style='width:100%; word-break:break-all;' class=tx></textarea>
</td>
<td width=80 align=right><input type="image" src="../skin/board/jins_cate/img/btn_c_ok.gif" border=0 accesskey='s'></td></tr>
</table>
</form>
Here's my Name-Value Pair:
List<NameValuePair> params2 = new ArrayList<NameValuePair>();
params2.add(new BasicNameValuePair("w", "c"));
params2.add(new BasicNameValuePair("bo_table", "specup")); //DYNAMIC
params2.add(new BasicNameValuePair("wr_id", "337877")); //DYNAMIC
params2.add(new BasicNameValuePair("comment_id", ""));
params2.add(new BasicNameValuePair("sca", ""));
params2.add(new BasicNameValuePair("sfl", ""));
params2.add(new BasicNameValuePair("stx", ""));
params2.add(new BasicNameValuePair("spt", ""));
params2.add(new BasicNameValuePair("page", "6")); //DYNAMIC
params2.add(new BasicNameValuePair("cwin", ""));
params2.add(new BasicNameValuePair("wr_content", "hello"));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要对发送到服务器的任何内容进行 URL 编码。也许您已经这样做了,但是您提交的代码示例并未显示这一点。
您可以看一下这个示例: http://www. androidsnippets.com/executing-a-http-post-request-with-httpclient
I think you need to URL-encode whatever you're sending to the server. Maybe you're already doing so, this is something your submitted code example doesn't show, however.
You can have a look at this example: http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient