怎么保存一个在table中动态添加一行的数据保存到数据库中,我用的是ssh动态添加的数据怎么保存SSH
解决方案 »
- 为什么java只支持单继承?多继承的缺点在接口也同样存在
- 请求帮助,页面显示两表查询数据。
- WEB + Swing + Socket lazy= true ,no session or session was closed
- Eclipse中如何由UML类图直接生成代码
- hibernate 中 如何把一个类映射到两张不同的表中
- 文件上传的时候报错:java.io.IOException: Corrupt form data: premature ending
- 上海,J2EE,我为什么找不到工作?
- 一个简单的hibernate问题
- 有谁可以提供给我一份关于xerces的xml解析器的所有函数帮助文档,为什么我在它的网站xml.apache.org没有找到它的1.4.1的文档。还有关于sax2.0的文档也没找到。谢谢!
- login方法中不改变int类型的情况下如何返回username和password
- 模糊查询
- 在spring+ibatis中使用LAST_INSERT_ID()是否安全?
现在我没有思路不知道该怎么写,在action中该怎么呢?
var table=document.getElementById("t1");//得到一个table值;
var tbody=document.getElementById("tbody1");//得到一个tbody值;
var trAdd=document.createElement("tr");//声明一个tr;
var tdOne=document.createElement("td");//声明一个td;
var tdTwo=document.createElement("td");
var tdStree=document.createElement("td");
var tdFour=document.createElement("td");
var tdFive=document.createElement("td");
tdOne.innerHTML='<input type="checkbox" name="box" id="title.id" size="1%"/>';//要添加的内容;
tdTwo.innerHTML='<input type="text" name="title.tnumber" size="1%" readonly/>';
tdStree.innerHTML='<textarea rows="2" cols="53" name="title.tcontent"/>';
tdFour.innerHTML='<input type="text" name="title.score" size="3%"/>';
tdFive.innerHTML='<a href="a_queryAnswer.action">答案管理</a>';
trAdd.appendChild(tdOne);//把td追加到tr中;
trAdd.appendChild(tdTwo);
trAdd.appendChild(tdStree);
trAdd.appendChild(tdFour);
trAdd.appendChild(tdFive);
tbody.appendChild(trAdd);//把tr追加到tbody中;
table.appendChild(tbody);//把tbody追加到table中;
}这是我写的动态添加的代码javaScript中的
下面是jsp中body
<div align="center">
<img src="Images/2.jpg">
<s:form action="t_addTitle.action" method="post">
<div align="right">
<table class="top">
<tr>
<td class="top1">
<input type="submit" name="save" value="保存" onClick="">
</td>
<td class="top1">
<input type="button" name="return" value="返回"
onClick="window.location.href='examinationInformation.jsp'">
</td>
</tr>
</table>
</div>
<div>
<table class="datalist" border="1px" cellpadding="0"
cellspacing="0" id="t1">
<tr>
<th width="6%">
<input type="checkbox" value="全选" id="btn" onclick="love()" />
</th>
<th width="6%">
序号
</th>
<th width="60%" align="left">
题目内容
</th>
<th width="10%">
分数
</th>
<th width="20%">
操作
</th>
</tr> <tbody id="tbody1">
<c:forEach items="${titleList}" var="list">
<tr>
<td width="3%">
<input type="checkbox" value="${list.id}" name="box" id="id"
size="1%" />
</td>
<td width="5%">
<input type="text" value="${list.tnumber}" name="tnumber"
id="tnumber" size="1%" />
</td>
<td width="30%">
<textarea rows="2" cols="53" name="title.tcontent"
id="title.tcontent">${list.tcontent}</textarea>
</td>
<td width="15%">
<input type="text" value="${list.score}" name="score"
id="score" size="3%" />
</td>
<td width="20%" class="ys">
<a href="a_queryAnswer.action">答案管理</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div> <div class="div_fenye">
<p class="font_p1">
<tr>
<td align="center">
第${pageNo}页
<a href="t_queryTitle.action?pageNo=1">首页</a>
<s:if test="#attr.pageNo> 1">
<a href="t_queryTitle.action?pageNo=${pageNo-1}">上一页</a>
</s:if>
<s:else>上一页</s:else>
<s:if test="#attr.pageNo lt #attr.totalpages">
<a href="t_queryTitle.action?pageNo=${pageNo+1}">下一页</a>
</s:if>
<s:else>下一页</s:else>
<a href="t_queryTitle.action?pageNo=${totalpages}">末页</a>
共${totalpages}页
</td>
</tr>
[ 每页显示
<font color="red">${pageRows}</font>条记录/总共
<font color="red">${count}</font>条记录 ]
</p>
</div>
<div align="right">
<table class="btn">
<tr>
<td class="btn1">
<input type="button" name="importTitle" value="导入题目" onClick="">
</td>
<td class="btn1">
<input type="button" name="add" value="添加" onclick="addNode()">
</td>
<td class="btn1">
<input type="button" name="delete" value="删除"
onClick="deleteNode()">
</td>
</tr>
</table>
</div>
</s:form>
</div>
action 代码没写出来public String addTitle(){
System.out.println(title.getId()+"_______________"+"__"+title.getTnumber()+"---------"+title.getTcontent()+"____"+title.getScore());
System.out.println("ddddddddddddddddddddd");
// report=reportBiz.findById(report.getId());
// title.setReport(report);
// answer=answerBiz.findById(answer.getId());
// title.setAnswer(answer);
System.out.println("****报表ID*******"+report.getId());
System.out.println("************"+answer.getId());
// titleBiz.save(title);
return "addTitle";
}
我下面该怎么写才能把动态添加的一行数据保存到数据库呢?
谢谢!
ssh + mysql 做的