ss003620
2012-11-12 18:05
浏览 406
已采纳

JSTL<c:forEarch>的问题

<%@ page language="java" import="java.util.*,com.unis.vo.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:useBean id="error" scope="request" class="java.lang.String"></jsp:useBean>
<jsp:useBean id="provinceList" scope="request" class="java.util.ArrayList"></jsp:useBean>
<jsp:useBean id="cityList" scope="request" class="java.util.ArrayList"></jsp:useBean>
<jsp:useBean id="hobbyList" scope="request" class="java.util.ArrayList"></jsp:useBean>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'useradd.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  
  <body >
  <font color="red">${error }</font>
    <form action="servlet/UserAdd" name="userAddForm" method="post">
            <c:forEarch items="${provinceList}" var="i">
            
            ${i.prvinceName}
            </c:forEarch>
      </form>
  </body>
</html>

用JSTL的<c:forEarch>循环输出provincelist的属性值,错误代码500,求解

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • ivivi852086 2012-11-12 22:27
    已采纳

    错误代码为500的话应该是你的action不对啊,如果是《c:forEach》标签的话会报jsp错误的,当然此处的c:froEach是写错了

    已采纳该答案
    打赏 评论
  • blogzhoubo 2012-11-12 19:02

    <c:forEarch应该是<c:forEach

    ${i.prvinceName}是不是应该是${i.provinceName}?

    打赏 评论
  • jiamin13579 2012-11-13 23:20

    没引进包?

    打赏 评论

相关推荐 更多相似问题