电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

wml页面传递变量具体代码


发布日期:2018/6/15
 

一起来看代码 wapTestjsp

<%@ page language=java import=javautil* contentType=text/vndwapwml;charset=GBK%>

<%

String path = requestgetContextPath();

String basePath = requestgetScheme()+://+requestgetServerName()+:+requestgetServerPort()+path+/;

%>

<?xml version= Encoding=GBK?>

<!DOCTYPE wml PUBLIC //WAPFORUM//DTD WML //EN

_xml>

<wml>

<head>

<meta httpequiv=contentType content=text/vndwapwml/>

<meta httpequiv=Expires content= />

<meta httpequiv=CacheControl content=nocache/>

</head>

<card id=list title=choose company>

<select name=company>

<option onpick=#sa>索爱</option>

<option onpick=#nokia>Nokia</option>

</select>

</card>

<card id=sa title=索爱>

<do type=accept label=OK>

<go #test></go>

</do>

<select name=type>

<option value=索爱>索爱</option>

<option value=索爱>索爱</option>

</select>

</card>

<card id=nokia title=Nokia>

<do type=accept label=OK>

<go #test></go>

</do>

<select name=type>

<option value=Nokia>Nokia</option>

<option value=Nokia>Nokia</option>

</select>

</card>

<card id=test title=postfield>

<p>型号:$type</p>

<do type=accept label=submit>

<go method=post>

<postfield name=company value=$type/>

</go>

</do>

</card></wml>

servlet

路径:wapTest

public void doGet(HttpServletRequest request HttpServletResponse response)

throws ServletException IOException

{

responsesetContentType(text/vndwapwml;charset=gbk);

PrintWriter out = responsegetWriter();

outprint(<wml>);

if(requestgetParameter(company)!=null)

{

outprint(<card><p>company is:+requestgetParameter(company));

outprint(</p></card>);

}

outprint(</wml>);

outflush();

outclose();

}

当然jsp就可以通过url传递<a >jsp</a>

上一篇:summarize SOAP概述

下一篇:在页面方法执行或控件方法执行查找性能瓶颈