Struts-menu 权限控制<一>

基本配置我就不多说了,网上多的很,我这里只说一下具体实现,呵呵

 

采用Struts+Hibernate

一、新建菜单表:表根据配置文件自己建吧,我这里就不写了

二、建立表对应的Hibernate的配置文件及JAVABEAN

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<!--

    Mapping file autogenerated by MyEclipse - Hibernate Tools

-->

<hibernate-mapping>

    <class name="com.wz.hibernate.Menu" table="menu" catalog="gknews">

        <id name="id" type="java.lang.Integer">

            <column name="id" />

            <generator class="native" />

        </id>

        <property name="parent" type="java.lang.String">

            <column name="parent" not-null="true" />

        </property>

        <property name="name" type="java.lang.String">

            <column name="name" length="45" not-null="true" />

        </property>

        <property name="target" type="java.lang.String">

            <column name="target" length="45" not-null="true" />

        </property>

    </class>

</hibernate-mapping>

package com.wz.hibernate;

 

public class Menu  implements java.io.Serializable {

 

     private Integer id;

     private String parent;

     private String name;

     private String target;

 

    /** default constructor */

    public Menu() {

    }

    /** full constructor */

    public Menu(String parent, String name, String target) {

        this.parent = parent;

        this.name = name;

        this.target = target;

    }  

    // Property accessors

    public Integer getId() {

        return this.id;

    }   

    public void setId(Integer id) {

        this.id = id;

    }

    public String getParent() {

        return this.parent;

你可能感兴趣的:(java,Hibernate,.net,MyEclipse,struts)