论坛首页 AJAX版 EXT

请问怎么让server返回的json数据自动回填到我的form里头去?

浏览 10922 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2008-01-13
感谢大家的帮助
这里有2个问题:
1、reader : new Ext.data.JsonReader({
successProperty: 'success',
root: 'data'
}
2、返回数据需要[]
   
0 请登录后投票
最后更新时间:2008-01-13
我觉得大家是不是应该些改扩展的回填方法,这样能根据自己的应用大部分自动回显示
   
0 请登录后投票
最后更新时间:2008-01-22
java+struts2+ext+json实现CRUD
http://hellboy.javaeye.com/admin/blogs/158338
这里有一个较为详细的例子
   
0 请登录后投票
最后更新时间:2008-02-23
建议关注一下hocate开源框架,他可以直接返回一个java对象为一个json对象
   
0 请登录后投票
最后更新时间:2008-04-02
如果是combobox类型,如何回填?
   
0 请登录后投票
最后更新时间:2008-04-07
记得在EXT2.0的时候不能自动填充Radio/Checkbox 数据 官方解释是

You can't use a single value for multiple fields using name/value. inputValue just sets the underlying radio's value attribute. Checkboxes and radios expect booleans (a number will work fine). You will need to either use an id or a dataIndex
   
0 请登录后投票
最后更新时间:2008-04-17
这个格式问题搞了我很久,你们太牛了
   
0 请登录后投票
最后更新时间:2008-05-05
$.fn.setfieldsValue = function(dat) {
	return this.each(function() {
		if (this.name==undefined || dat[this.name]==undefined) return;
		$(this).val(dat[this.name]);
	});
}

 jQuery语法的扩展,很简单的问题.调用示例:

$('youform [name]').setfieldsValue(dat);

当然dat就是数据了,我这个是随手写的,在你的应用里调用方法也许会有不同,也就是说关键是如何确定对象了.

在EXT区发jQuery是不是不太好呀!如果是的话,请大家说一声,我以后就不这么干了.

   
0 请登录后投票
最后更新时间:2008-05-15
onionppp 写道
test.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="com.ext.util.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>

<body>
<%
String id = request.getParameter("id");
    String name = "123";

String password ="123"

System.out.println("id="+id);
try{
// String json = "{\"success\":true,\"data\":[";
//        json += "{\"name\":\""+name+"\"}";//,{\"password\":"+"\""+password+"\"}
String json = "{success:true,data:";
        json += "{name:'"+name+"'}";
    json += "}";
    response.getWriter().write(json);
    response.getWriter().flush();
    System.out.println(json);
}catch(Exception e){}

%>
</body>
</html>


test.jsp中去掉所有的html信息和语句再试试。
   
0 请登录后投票
最后更新时间:2008-07-21
我得是Combobox回显不了,谁知道用那个 setValue方法怎么得到数据源,从而可以set这个combobox的初始化值?
   
0 请登录后投票
论坛首页 AJAX版 EXT

跳转论坛:
JavaEye推荐