我做的一个修改信息的功能,先根据用户点击的id查出来对应的数据,然后将数据返回前台,我将这些数据,放在了一个table中,然后将table放在这个层里面,然后点击修改,将修改后的数据怎么传到后台Action中?求各位大侠帮忙了!谢谢了
给个思路也行啊
给个思路也行啊
解决方案 »
- 使用HQL语句将结果作为pojo对象的错误问题,请大家指点,谢谢啦!
- 一个空指针异常,不知道怎么解决,帮帮忙
- 隐藏ie标题栏
- Statement stmt = Conn.createStatement(1004,1007);
- tomcat所有版本都支持win98吗?为什么我的jakarta-tomcat-4.1.31在win98下不能安装?
- jsp传值乱码问题???
- servlet为什么不能正常运行?
- 用SSH开发的一个网站的奇怪现象
- Calendar 的add(field,int) 问题
- servlet快在哪里?(什么时候用servlet好?)
- hql:获取从当前时间的第二天算起,获得最近过生日的用户数据
- 关于取数据库数据乱码的问题
$.ajax({
url: "student!update.action",
type: "post",
data: null,
cache: false,
beforeSend: function(result) {
},
success: function(result) {
alert("成功!");
$('#dialog-overlay, #dialog-box').hide();
},
error: function(result, status) {
if (status == 'error') {
alert("系统发生错误");
}
}
});
}这里面应该怎么提交啊?
</form>
function update(){
document.updateForm.submit();
}然后在action中。
request.getpre..("XXX")
估计可以达到你要的效果
http://topic.csdn.net/u/20080221/15/d47fac18-1542-4d8f-917e-ba138a632023.html
items:[
{x:0,y:5,xtype:'label',text:'昵称:'},
{x:60,y:0,name: 'username',width:'130' },
{x:230,y:5,xtype:'label',text:'姓名:'},
{x:290,y:0,name: '_name',width:'130'},
{x:0,y:35,xtype:'label',text: '密码:'},
{x:60,y:30,name:'_password',width:'130'},
{x:230,y:35,xtype: 'label',text: '重复密码:'},
{x:290,y:30,name:'doublePass',width:'130'},buttons:[{
text:'Send',
handler:function(){
if(perform.form.isValid()){
perform.form.submit({
url:'/Extjs_Center/personnelAction.do?method=addPersonnel',
method:'post',
success: function(form,action){
if(action.result.msg=='succ'){
document.location='../../jsp/personnel/personnelList.jsp';
}else{
Ext.Msg.alert('false','员工创建失败!');
}
},
failure: function(form,action){
Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
}
});
}
}
},{
text: 'Cancel'
}]
public ActionForward addPersonnel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PersonnelForm frm = (PersonnelForm) form;
System.out.println(frm.getUsername()+" "+frm.get_password());
PersonnelBo pbo = new PersonnelBo();
pbo.AddPersonnel(response, frm);
return null;
}
<form action="student!update.action" name="updateForm">
</form>
function update(){
document.updateForm.submit();
}然后在action中。
request.getpre..("XXX")
...
</form>
这个方法是取表单name的值。你的表单里都是ID,没NAME怎么取值嘛。你把你ID改成name试试
$.ajax({
url: "student!update.action",
type: "post",
data: {
//在这里加入你保存的参数值
username:"",
password:""
},
cache: false,
beforeSend: function(result) {
},
success: function(result) {
alert("成功!");
$('#dialog-overlay, #dialog-box').hide();
},
error: function(result, status) {
if (status == 'error') {
alert("系统发生错误");
}
}
});
}
//这里直接根据它们的id取值,得到值后然后将值通过data传到后台
var id = document.getElementById("id").value;
var username = document.getElementById("username").value;
var stuid = document.getElementById("stuid").value;
var phone = document.getElementById("phone").value;
var address = document.getElementById("address").value;
var email = document.getElementById("email").value;
$.ajax({
url: "student!change.action",
type: "post",
data: ({"id":id,"username":username,"stuid":stuid,"phone":phone,"address":address,"email":email}),//这里就是你要传的值,这里要注意写法
cache: false,
beforeSend: function(result) {
},
success: function(result) {
alert("更新成功!");
$('#dialog-overlay, #dialog-box').hide();
},
error: function(result, status) {
if (status == 'error') {
alert("系统发生错误");
}
}
});
}