<%
UserDetailsVO objUserDetailsVO = null;
ArrayList arlUserDetailsVO = (ArrayList)request.getAttribute("LSTUSERSDETAILS");
String nonBifFlag = "";
if(arlUserDetailsVO !=null){
Iterator it = arlUserDetailsVO.iterator();
String urlProfile="";
while(it.hasNext()){
objUserDetailsVO = (UserDetailsVO)it.next();
urlProfile = "UserProfile.htm?userID="+objUserDetailsVO.getLogin_Ident()+"&internalID=111"+objUserDetailsVO.getInternalId();
%>
解决方法:
确保您的类路径中有来自JSTL的jstl.jar和standard.jar(即,Web项目的WEB-INF / lib文件夹).在jsp页面的顶部,您将需要:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
您的代码的文字翻译如下所示:
<c:set var="objUserDetailsVO" value="${null}"/>
<c:set var="arlUserDetailsVO" value="${requestScope['LSTUSERSDETAILS']}"/>
<c:set var="nonBifFlag" value=""/>
<c:if test="${not empty arlUserDetailsVO}">
<c:set var="urlProfile" value="${null}"/>
<c:forEach var="objUserDetailsVO" items="${arlUserDetailsVO}">
<c:url var="urlProfile" value="UserProfile.htm">
<c:param name="userID" value="${objUserDetailsVO.login_Ident}"/>
<c:param name="internalID" value="111${objUserDetailsVO.internalId}"/>
</c:url>
</c:forEach>
</c:if>
尽管考虑到您实际上不需要将页面/请求属性设置为null,因为它们已经为空,但是您可以将其简化为:
<c:set var="arlUserDetailsVO" value="${requestScope['LSTUSERSDETAILS']}"/>
<c:if test="${not empty arlUserDetailsVO}">
<c:forEach var="objUserDetailsVO" items="${arlUserDetailsVO}">
<c:url var="urlProfile" value="UserProfile.htm">
<c:param name="userID" value="${objUserDetailsVO.login_Ident}"/>
<c:param name="internalID" value="111${objUserDetailsVO.internalId}"/>
</c:url>
</c:forEach>
</c:if>
请注意,通过使用< c:url>为了构造您的网址,您的网址参数现在将正确编码,因为您的Java代码段中未对它们进行编码.