wml表单提交

WML表单提交 程序代码
关键词:<input name="keyword" title="keyword" type="text" format="*M" emptyok="false" maxlength="12"/><br/>
<anchor title="搜索">搜索
<go href="http://wap.mzwu.com/" method="get">
<postfield name="key" value="$(keyword:escape)"/>
</go>
</anchor>

程序代码
关键词:<input name="keyword" title="keyword" type="text" format="*M" emptyok="false" maxlength="12"/><br/>
<do type="accept" label="搜索" name="do01">
<go href="http://wap.mzwu.com/" method="get">
<postfield name="key" value="$(keyword:escape)"/>
</go>
</do>

上边两种方式都可以用来提交表单,下边说下几个伪指令的含义:

$(keyword:escape):指示微浏览器将非文本数字的字符替换成十六进制代码;
$(keyword:unesc):指示微浏览器用相应的字符替换十六进制代码;
$(keyword:noesc):指示微浏览器准确的按照字符出现的样子处理他们;

WML似乎没有类型为hidden的input,如有些参数需隐藏发送,可直接在go中设置:

程序代码
关键词:<input name="keyword" title="keyword" type="text" format="*M" emptyok="false" maxlength="12"/><br/>
<anchor title="搜索">搜索
<go href="http://wap.mzwu.com/" method="get">
<postfield name="key" value="$(keyword:escape)"/>
<postfield name="mid" value="3"/>
</go>
</anchor>
=================================================================================================
index.wml文件,提交到testreceive.jsp文件

<?xml version="1.0"?>
<!doctype wml public "-//wapforum//dtd wml 1.1//en" "http://www.wapforum.org/dtd/wml_1.1.xml">
<wml>
<card title="信息发布">
<do type="accept" label="提交" name="do1">
<go href="testreceive.jsp" method="post">
<postfield name="infotype" value="$(infotype)"/>
<postfield name="infotitle" BACKGROUND: #ffff00; COLOR: #000000">infotitle"/>
<postfield name="infocontent" value="$infocontent"/>
<postfield name="SFoodName" value="$SFoodName"/>
</go>
</do>

<p>请选择你要发布信息的种类:
<br/>
<select name="infotype">
<option value="1001">货运</option>
<option value="1002">家具家电</option>
<option value="1003">电脑数码</option>
<option value="1004">手机通讯</option>
<option value="1005">汽车</option>
<option value="1006">创投信息</option>
<option value="1007">其它</option>
<option value="1008">家政</option>
<option value="1009">搬家</option>
<option value="10010">出租</option>
<option value="10011">求租</option>
<option value="10012">招聘信息</option>
<option value="10013">司机中介</option>
<option value="10014">待聘</option>
</select>
<br/>
请输入要发布的标题:<br/>
<input name="infotitle" type="text" size="30" maxlength="60"/>
<br/>
请输入要发布的内容:<br/>
<input name="infocontent" type="text" size="40" maxlength="60"/>
<br/>
<select title="选择图片" name="imgurl">
<option value="images/128_128a.gif">图一</option>
<option value="images/128_128b.gif">图二</option>
</select>
</p>


<p align="left">
请输入菜名<br/>
<input title="abc" name="SFoodName" maxlength="20" /><br/>
</p>

<p>
<anchor title="确定">Go to rec
<go method="post" href="testreceive.jsp">
<postfield name="infotype" value="$(infotype)"/>
<postfield name="infotitle" BACKGROUND: #ffff00; COLOR: #000000">infotitle"/>
<postfield name="infocontent" value="$infocontent"/>
<postfield name="SFoodName" value="$SFoodName"/>
</go>
</anchor>
</p>

<p>
<br/>
</p>
</card>
</wml>

testreceive.jsp

<%
response.setContentType("text/vnd.wap.wml;charset=gb2312");

out.println("<?xml version=\"1.0\" encoding=\"gb2312\"?>");

out.println("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">");

%>
<%@ page language="java" contentType="text/vnd.wap.wml;charset=gb2312"%>
<wml>
<card id="card1" title="信息发布">
<p>
接收到的信息如下:
<%
out.println(request.getParameter("infotype"));
out.println(request.getParameter("infotitle"));
out.println(request.getParameter("infocontent"));
out.println(request.getParameter("SFoodName"));

%>
</p>
</card>
</wml>

你可能感兴趣的:(jsp,浏览器,招聘,Go,WAP)