提问一个问题,(jsp)我把所有图片查询出来了,name id 日期,发在文本框里,点击修改,我调试了一下,form里面什么都没有。。谢谢各位大虾

starbhhc 2010-04-25 06:09:02
<div><!-- InstanceBeginEditable name="EditRegion3" -->
<table width="1024" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="23"> </td>
</tr>
</table>
<table width="1024" height="191" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="191" align="center" valign="middle"><span class="STYLE11 STYLE14">
</span><img src="images/help.png" width="1004" height="197"></td>
</tr>
</table>
<table width="1024" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="1024" height="555" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="757" height="555" align="center" valign="top"><table width="749" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/caozuo.gif" width="747" height="28"></td>
</tr>
</table>

<table width="760" height="785" border="0" cellpadding="0" cellspacing="0" bordercolor="#66DCF9">
<TBODY>
<c:forEach var="pic" items="${requestScope.list}" varStatus="status">
<c:if test="${status.index%2==0}">
<tr>
</c:if>
<td width="807" height="343" valign="top">
<form name="frm" method="post" action="#">
<table width="354" height="343" border="0" align="left" cellpadding="0" cellspacing="0">
<tr> <td height="2" colspan="3" align="center" valign="bottom"><hr width="350"></td>
<td width="4" rowspan="9" align="left" valign="top"> </td>
</tr>
<tr>
<td width="145" rowspan="7" align="center" valign="middle"><img src="picture/<bean:write name="pic" property="pname"/>" alt="您截取的图片" width="145" height="167"></td>
<td height="47"><span class="STYLE18">图片名称:</span></td>
<td>
<input id="pname" name="pname" type="text" onblur="checkForm()" value="<bean:write name='pic' property='pname'/>" size="18">
</td>
</tr>
<tr>
<td width="78" height="39"><span class="STYLE18">图片类型:</span></td>
<td width="131"><input name="pformat" disabled="disabled" value="<bean:write name="pic" property="pformat"/>"type="text" size="18"></td>
</tr>
<tr>
<td height="46"><span class="STYLE18">图片宽度:</span></td>
<td><input name="pwidth" type="text" value="<bean:write name="pic" property="pwidth"/>" disabled="disabled"size="18"></td>
</tr>
<tr>
<td height="48"><span class="STYLE18">图片高度:</span></td>
<td><input name="pheight"type="text" value="<bean:write name="pic" property="pheight"/>" disabled="disabled"size="18" ></td>
</tr>
<tr>
<td height="38"><span class="STYLE18">截图时间:</span></td>
<td><input name="pdata" value="<bean:write name="pic" property="pdata"/>" type="text" disabled="disabled"size="18"></td>
</tr>
<tr>
<td height="41"><span class="STYLE18"><a href="javaScript:submits()">删除/批量</a></span></td>
<td><input name="deletem" type="checkbox" id="deletem" value="<bean:write name="pic" property="pictureid"/>"></td>
</tr>
<tr>
<td height="38" valign="middle">
<span class="STYLE18">
<a href="picture.do?method=updatepictureByName&id=<bean:write name="pic" property="pictureid"/>">修改</a></span></td>
<td valign="middle"><span class="STYLE18"><a href="picture.do?method=deletePictureInfo&id=<bean:write name="pic" property="pictureid"/>">删除</a></span></td>
</tr>
<tr>
<td height="1" colspan="3" align="center" valign="middle"><hr width="350"></td>
</tr>
</table>
</form>
</td>
<c:if test="${status.index%2==1}">
</tr>
</c:if>
</c:forEach>
</TBODY>
</table>

</td>
<td width="267" align="left" valign="top">
<table width="213" height="188" border="0" cellpadding="0" cellspacing="0" style="background-image:url(images/zhuatu_19.jpg); background-position:center; background-repeat:no-repeat">
<tr>
<td height="112"> </td>
</tr>
</table><br>
<table width="213" height="188" border="0" cellpadding="0" cellspacing="0" style="background-image:url(images/bbs.jpg); background-position:center; background-repeat:no-repeat">
<tr>
<td height="119"> </td>
</tr>
</table><br>

<table width="213" height="188" border="0" cellpadding="0" cellspacing="0" style="background-image:url(images/question.jpg); background-position:center; background-repeat:no-repeat">
<tr>
<td> </td>
</tr>
</table><br>
<br></td>
</tr>
</table>

这是页面,查询所有出来了,点击修改拿到了ID,但是form里面全是null

package com.wantong.org.filecapturescreen.web.actionform;

import org.apache.struts.action.ActionForm;

public class PictureactionForm extends ActionForm{

/**
*
*/
private static final long serialVersionUID = 1L;
private int pictureid;
private String pname;
private String pdata;
private String psize;
private String pformat;
private String ppath;
private String pimages;
private String pwidth;
private String pheight;
private String classificationType;
private String pstatus;

public PictureactionForm() {
super();
}
public PictureactionForm(int pictureid, String pname, String pdata,
String psize, String pformat, String ppath, String pimages,
String pwidth, String pheight, String classificationType,
String pstatus) {
super();
this.pictureid = pictureid;
this.pname = pname;
this.pdata = pdata;
this.psize = psize;
this.pformat = pformat;
this.ppath = ppath;
this.pimages = pimages;
this.pwidth = pwidth;
this.pheight = pheight;
this.classificationType = classificationType;
this.pstatus = pstatus;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public int getPictureid() {
return pictureid;
}
public void setPictureid(int pictureid) {
this.pictureid = pictureid;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getPdata() {
return pdata;
}
public void setPdata(String pdata) {
this.pdata = pdata;
}
public String getPsize() {
return psize;
}
public void setPsize(String psize) {
this.psize = psize;
}
public String getPformat() {
return pformat;
}
public void setPformat(String pformat) {
this.pformat = pformat;
}
public String getPpath() {
return ppath;
}
public void setPpath(String ppath) {
this.ppath = ppath;
}
public String getPimages() {
return pimages;
}
public void setPimages(String pimages) {
this.pimages = pimages;
}
public String getPwidth() {
return pwidth;
}
public void setPwidth(String pwidth) {
this.pwidth = pwidth;
}
public String getPheight() {
return pheight;
}
public void setPheight(String pheight) {
this.pheight = pheight;
}
public String getClassificationType() {
return classificationType;
}
public void setClassificationType(String classificationType) {
this.classificationType = classificationType;
}
public String getPstatus() {
return pstatus;
}
public void setPstatus(String pstatus) {
this.pstatus = pstatus;
}
}
-----------------这是actionfrom


public ActionForward updatepictureByName(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int id=Integer.parseInt(request.getParameter("id"));
PictureactionForm pm=(PictureactionForm)form;
Picture picture=new Picture();
picture.setPictureid(id);
picture.setPname(pm.getPname());
int rseult=PictureFactoryService.getinstrance().updatepictureByName(picture);
if(rseult>0){
return mapping.findForward("deletepic");
}else{
return mapping.findForward("fail");
}

}
----------------------这是ation
...全文
82 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
starbhhc 2010-04-25
  • 打赏
  • 举报
回复
那我可不可是调用一个方法:
function show()

document.form.action="";
document.form.submit();
lp19890601 2010-04-25
  • 打赏
  • 举报
回复
建議: 修改跳到action,有ID,在action里面查处对象的数据,转跳另一個頁面赋值(发到文本框里)再提交表单修改
lp19890601 2010-04-25
  • 打赏
  • 举报
回复
[Quote=引用楼主 starbhhc 的回复:]
<a href="picture.do?method=updatepictureByName&id=<bean:write name="pic" property="pictureid"/>">修改</a></span>[/Quote]

你用的是鏈接,不是action,沒有提交過去表單,你要修改,要传过去对应的修改数据,不单单是一个ID,要获取form 就要提交表單!

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧