日期:2014-05-18  浏览次数:20626 次

xhtml中的链接使用get方式传2隔以上参数
下面是我的xhtml文件:  
<!DOCTYPE   html   PUBLIC   "-//WAPFORUM//DTD   XHTML   Mobile   1.0//EN "   "http://www.wapforum.org/DTD/xhtml-mobile10.dtd ">  
<html   xmlns= "http://www.w3.org/1999/xhtml ">  
<head>  
<title> JSP </title>  
<meta   http-equiv= "Expires "   content= "Tue,   01   Jan   1980   12:00:00   GMT "   />  
<meta   http-equiv= "Content-Type "   content= "application/xhtml+xml;   charset=utf-8 "/>  
<meta   http-equiv= "cache-control "   content= "no-cache "   />  

</head>  
<body>  
<a   href= "xxx.jsp?id=1&to=article "> xxxx </a>  
</body>  
</html>  
我想在xxx.jsp中得到id=1和to=article,  
这在html中是可以的.但是在xhtml中,  
XML   分析失败:   语法错误   (行号:   14,   字符:   26)  
错误:invalid   entity   reference   in   attribute   value  
规范:http://www.w3.org/TR/REC-xml/  

那行,就是连接的那行,错误就是&to  
小弟刚学xhtml,希望各位能帮忙解决这问题,  
如果能提供几个学习的好地方那太感谢了

------解决方案--------------------
我测试在jsp页面取值没有问题呀。

<%@ page language= "java " import= "java.util.* " pageEncoding= "ISO-8859-1 "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> My JSP 'error.jsp ' starting page </title>
</head>
<body>
<%=request.getParameter( "id ")%>
<br>
<%=request.getParameter( "to ")%>
</body>
</html>

页面输出:
1
article