老师我用setAttribute传一个数组过去,为什么无法输出
<q:forEach items="arr" var="arr[i]">
<q:if test="${arr[i]%4==0&&arr[i]%5==0 }">
<q:out value="${arr[i] }"></q:out>
</q:if>
</q:forEach>
正在回答
代码改成如下形式:
<q:forEach items="${arr}" var="arr1">
<q:if test="${arr1%4==0&&arr1%5==0}">
<q:out value="${arr1}"></q:out>
</q:if>
</q:forEach>
祝学习愉快!
代码改成如下形式:
<q:forEach items="${arr}" var="arr1">
<q:if test="${arr1%4==0&&arr1%5==0}">
<q:out value="${arr1}"></q:out>
</q:if>
</q:forEach>
祝学习愉快!
@WebServlet("/JSTLELServlet")
public class JSTLELServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@SuppressWarnings("null")
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int arr[]=new int[101];
for(int i=0;i<=100;i++)
{
arr[i]=i+100;
}
request.setAttribute("arr", arr);
request.getRequestDispatcher("/1.jsp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
- 参与学习 716 人
- 提交作业 185 份
- 解答问题 1363 个
会Java?懂前端基础?想学后台开发?那么,赶快来学习《Java Web入门》路径吧。本路径主要介绍Java Web的基础知识,并配有大量案例,定会让你收获多多!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星