日期:2014-05-19 浏览次数:20940 次
package com.log.action.tree;
import java.util.List;
import com.log.manager.tree_Manager;
import com.log.model.treemodel;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
public class Tree_Action extends ActionSupport {
private tree_Manager tree_manager;
private List<treemodel> tree_model;
private int id;
private int pid;
private String name;
private String url;
private String target;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public void setTree_manager(tree_Manager tree_manager) {
this.tree_manager = tree_manager;
}
@Override
public String execute() throws Exception {
tree_model=tree_manager.listTree();
//这里如何转换成jeson,以及如何发送给客户端页面
return SUCCESS;
}
}
package com.log.model;
/**
*
* @author kingbug.zhang
* @hibernate.class table="tb_tree_Model"
*/
public class treemodel {
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* 父ID
* @hibernate.property
*/
private int pid;
/**
* 名称
* @hibernate.property
*/
private String name;
/**
* 跳转地址
* @hibernate.property
*/
private String url;
/**
* 跳转窗口
* @hibernate.property
*/
private String target;
}
get set 方法省略。。。。。。
public class tree_Manager_Impl extends HibernateDaoSupport implements tree_Manager {
@SuppressWarnings("unchecked")
public List<treemodel> listTree() {
String hql="from treemodel user order by user.id";
return getHibernateTemplate().find(hql);
}
}
Ext.onReady(function(){
//Ext.util.CSS.swapStyleSheet("theme", "extjs/resources/css/xthem