日期:2014-05-19  浏览次数:20578 次

action设置JSP的值
我写了个页面index.jsp,嵌套了一个iframe,然后iframe的页面提交了一次数据到后面经过action处理后,返回值给index.jsp,要对index.jsp中的一个文本框设值,最后的一步要怎么做呀

index.jsp
<s:textfield name="imageUrls" size="80" id="imageUrls"></s:textfield>
  <div id="ids1">
  <iframe name=hot-img align=top src="/admin/uploadimg.jsp 
  urlid=imageUrls&imageUrls=${product.imageUrls }"
  frameborder=0 width="550px" height="150px"scrolling="0">
  </iframe>
  </div>

uploadimg.jsp 
<s:form name="uploadImgForm" id="uploadImgForm" action="product!upload" namespace="/"
enctype="multipart/form-data" method="post">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="more">
<s:file name="file" ></s:file>
<span></span>
<input type="button" value="添加多个" onclick=addMore(); />
<input type="submit" name="Submit" class="textfield" value="上传图片">
<span style="color: red;">提示:每次最多上传5张图片</span>

<input type="hidden" name="urlid" value="${param.urlid }" />
<input type="hidden" name="imageUrls" value="${param.imageUrls }"/>
</td>
</tr>
</table>
</s:form>

ProductAction.java中upload方法
public String upload() throws IOException{
一系列处理后

out.print("<script>alert('更新图片成功');parent.document.myform."+ urlid +".value='" + imageUrls + "';history.back();</script>");

return null;
}

页面会报parent.document.myform.imageUrls为空


------解决方案--------------------
你把history.back() 写在alert后面试试呢~~