在jsp页面中,如果我要点下面的链接,把city=bj这个参数传入test.jsp的查询页面,可得到qudao=bj的结果
相当于在下一个页面执行了一句 select * from tab where city='bj' AND STATE='F0A' ---STATE='F0A'表示状态正常<a href="test.jsp?city=bj&state=F0A>点此链接</a>那么问题是,如果,要得到类似于
select * from tab where city in ('bj','sh') and state='F0A'
的效果,链接的语句应该怎么写?
相当于在下一个页面执行了一句 select * from tab where city='bj' AND STATE='F0A' ---STATE='F0A'表示状态正常<a href="test.jsp?city=bj&state=F0A>点此链接</a>那么问题是,如果,要得到类似于
select * from tab where city in ('bj','sh') and state='F0A'
的效果,链接的语句应该怎么写?
得到参数后以“,”分隔取值~
<script language="javascript">
function encode(href,param){
var str=encodeURIComponent(param);
window.location.href=href+"?"+str
}
</script>
<a href="a.jsp" onclick="encode(this.href,'param=select * from tab where city in (\'bj\',\'sh\') and state=\'F0A\'');return false">aa</a>
function encode(href,param){
var str=encodeURIComponent(param);
window.location.href=href+"?param="+str
}
</script>
<a href="a.jsp" onclick="encode(this.href,'select * from tab where city in (\'bj\',\'sh\') and state=\'F0A\'');return false">aa</a>
请问这个encode()是专门用来链接转义的么?
里面写sql的方式比如 in ('bj','sh)
得写成
in (\'bj\',\'sh\')
那么其他一些关键sql语句的写法到了这个encode()里该如何写?该参考哪方面的东西?
ps:在网上搜了 encode()好像没得到我想要的。
服务器端获得的是一个city数组