<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@page   import= "java.util.* " %> 
<%
String path = request.getContextPath();
List photolist=(List)request.getAttribute("photolist");

%>
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="<%=path%>/js/livevalidation2.js"></script><link href="<%=path%>/css/user.css" rel="stylesheet" type="text/css" /></head>
<body>
  <table width="1000" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="141" colspan="2"><Iframe src="<%=path%>/user/user_top.jsp" width="1000" height="141" scrolling="no" frameborder="0"></iframe></td>
  </tr>
  <tr>
    <td width="230" height="416" valign="top"><Iframe src="<%=path%>/user/user_left.jsp" width="230" height="400" scrolling="no" frameborder="0"></iframe></td>
    <td width="770" valign="top"><table width="755" border="0" cellspacing="0" cellpadding="0" class="center">
      <tr>
        <td height="30" align="center" background="<%=path%>/images/userimg/title.jpg"><table width="712" height="16" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="117" align="center" class="title">相片编辑</td>
           
            <td width="532">&nbsp;</td>
            <td width="63" class="red">*为必填项</td>
          </tr>
        </table></td>
      </tr>
      <tr><td align="center">
      
      </td></tr>
   
      <tr>
     
        <td align="center" valign="top"><table width="726" border="0" cellpadding="0" cellspacing="0">
          <html:form action="/UploadPhotoAction.do" enctype="multipart/form-data">
          <tr align="center">
            <td height="276" colspan="2" class="bottom_border"><table width="730" border="0" cellpadding="0" cellspacing="0">
                <%
           Map colMap; 
           for (int i=0; i< photolist.size(); i++){ 
           colMap = (Map) photolist.get(i); 
           
          %> 
              <tr>
                <td height="40" align="right" class="fus_gray"><span class="red">*</span>&nbsp;相片名称:</td>
                <td height="40"  align="left"><html:text property="image"   styleClass="text"  size="30" value="<%=colMap.get("u_photo_name").toString()%>"></html:text>
</td>
                </tr>
                
                <tr>
                <td width="93" height="20" align="right" class="fus_gray">&nbsp;</td>
                <td align="left" valign="top" class="low_gray"><span id="albumnameval">相片名字不能为空</span></td>
                </tr>
                
            
             
              <tr>
                <td height="40" align="right" valign="top" class="fus_gray">详细描述:</td>
                <td align="left" valign="top"><html:textarea property="imagdetails" cols="45" rows="3"  styleClass="textarea" value="<%=colMap.get("u_photo_details").toString()%>"></html:textarea></td>
              </tr>
              
              <tr>
                <td width="93" height="20" align="right" class="fus_gray">&nbsp;</td>
                <td align="left" valign="middle" class="low_gray"> <span id="albumdetailsval">内容不能超过80个字</span></td>
                </tr>
               
              <% 
               }// end for 
                 %>
            </table></td>
            </tr>
          <tr>
            <td height="50" colspan="2" align="center"><html:submit styleClass="release" value=" "></html:submit></td>
            </tr>
             </html:form>
          <tr>
            <td height="15" colspan="2" align="right">&nbsp;</td>
            </tr>
        </table></td>
      
      </tr>
       
    </table></td>
  </tr>
  <tr>
    <td height="93" colspan="2"><Iframe src="<%=path%>/user/user_foot.jsp" width="1000" height="93" scrolling="no" frameborder="0"></iframe></td>
  </tr>
</table>
  </body>
  <script type="text/javascript" src="<%=path%>/js/docphoto.js"></script>
</html:html>

解决方案 »

  1.   

    List photolist=(List)request.getAttribute("photolist"); 应该是这里是空值。什么地方记录的这个request.getAttribute("photolist");  system.out.print()打出来看看
      

  2.   

    也有可能是这里报错,<%=colMap.get("u_photo_details").toString()%>">,
    因为你的详细描述允许为空,但是在Map中get方法对key为Null时会抛出NullPointerException。