显示不是字符串的类型,我加上"也不好使",请问该怎么解决?

<%
List<String> list = (List<String>) request.getAttribute("list");
List<String> listjsp = (List<String>) request
.getAttribute("listjsp");
%>
//button按钮的上一页、下一页
function getButtonHref(actionType , localHref)
{
var targetURL = "";
var targetArray = new Array();
alert(localHref);
<%
for (int i = 0; i < list.size(); i++) {
%>
var ss = localHref.replace(<%=listjsp.get(i)%> , localHref.substring(localHref.lastIndexOf('/') + 1,localHref.indexOf('?'));
targetArray.push(ss);
<%
}
%>
for(var i = 0 ; i < targetArray.length ; i++)
{
alert(targetArray[i]);
}
$("div[align='top'] a").each(function(i){
var target = $(this).attr("href");
var localHrefTemp = localHref.substring(localHref.lastIndexOf('/') + 1,localHref.indexOf('?'));
target = target.substring(target.lastIndexOf('/') + 1,target.indexOf('?'));
if(target.indexOf(localHrefTemp) != -1)
{
if(i > 0 && "PrevPage" == actionType)
{
targetURL = targetArray[i-1];
}else if(i < $(this).length && "NextPage" == actionType){
targetURL = targetArray[i+1];
}else{
alert("跳转错误");
}

<%=listjsp.get(i)%>告诉我不是字符串的类型,我加上"也不好使",请问怎么解决啊,谢谢

}
});
return targetURL;
}

开满天机
浏览 141回答 1
1回答

潇潇雨雨

不好使是报错还是只是没达到替换的效果?正常来讲加双引号就行了"<%=listjsp.get(i)%>"
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript
Java