要用java做一个菜简单的单管理功能,要求如下:
1、添加、删除,修改,查看功能。无限级菜单;
2、采用ssh框架,struts2版本,mysql数据库,jquery,ajax,ssh框架采用xml文件配置的方式,采用struts标签;
3、菜单字段表:
1)menuId
2)menuName
3)menuCode:不能重复。在前台需要用ajax判断。
...等其他字段,自己添加。
4、需要递归显示菜单列表。
哪位写好后,发给小弟的邮件 350038760@qq.com
------解决思路----------------------
大哥你干脆去抢好了
------解决思路----------------------
百度一下,你就知道。
Google一下, 你知道的更多。
------解决思路----------------------
哥们 真幽默。
------解决思路----------------------
元芳你怎么看??
------解决思路----------------------
我是为10分进来的,最近分被用光了
------解决思路----------------------
+1
------解决思路----------------------
果断kuaibo,我会乱说?
------解决思路----------------------
可惜我最近都没学SSH了,都忘光了。
------解决思路----------------------
+2
------解决思路----------------------
public class bean {
private int id;
private String name;
private int pid;
public bean(int id,String name,int pid){
this.id=id;
this.name=name;
this.pid=pid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
}
这个是Bean
import java.util.ArrayList;
import java.util.List;
public class tree {
public static void main(String []args){
List <bean> list=new ArrayList<bean>();
list.add(new bean(1,"1",0));
list.add(new bean(2,"2",0));
list.add(new bean(3,"3",0));
list.add(new bean(4,"4",0));
list.add(new bean(5,"5",0));
list.add(new bean(6,"2",1));
list.add(new bean(7,"2",1));
list.add(new bean(8,"2",1));
list.add(new bean(9,"2",1));
list.add(new bean(10,"2",1));
list.add(new bean(11,"2",1));
list.add(new bean(12,"2",2));
list.add(new bean(13,"2",2));
list.add(new bean(14,"2",2));
list.add(new bean(15,"2",2));
list.add(new bean(16,"2",2));
list.add(new bean(17,"2",3));
list.add(new bean(18,"2",3));
list.add(new bean(18,"2",3));
list.add(new bean(18,"2",3));
list.add(new bean(18,"2",3));
list.add(new bean(19,"3",6));
list.add(new bean(20,"4",19));
list.add(new bean(21,"5",20));
System.out.println("<ul>");
for(bean b:list){
if(b.getPid()==0){
System.out.println("<li>"+b.getName()+"<>");
CreateTree(list,b.getId());
}
}
System.out.println("</ul>");
}
public static void CreateTree(List<bean> list,int pid){
System.out.println("<ul>");
for(bean b:list){
if(b.getPid()==pid){
System.out.println("\t<li>"+b.getName());
CreateTree(list,b.getId());
System.out.println("\t<>");
}
}
System.out.println("</ul>");
}
}
这个是遍历的语句。
可以根据你自己的要求增加