<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 495,comments - 227,trackbacks - 0
    2006-10-31 19:55

    ****************************************************************************************************************

    DAO里面如下寫:

    package com.sinoconcept.match.dao.impl;

    import java.util.List;

    import org.springframework.dao.DataAccessException;

    import com.sinoconcept.match.dao.DirctDAO;

    public class DirctDAOImpl extends BaseDAOHibernateImpl implements DirctDAO {

    ?public List loadAll(String className) {
    ??
    ??try {
    ???return this.getHibernateTemplate().loadAll(Class.forName(className));
    ??} catch (DataAccessException e) {
    ???// TODO Auto-generated catch block
    ???e.printStackTrace();
    ??} catch (ClassNotFoundException e) {
    ???// TODO Auto-generated catch block
    ???e.printStackTrace();
    ??}
    ??return null;
    ?}

    }

    ***************************************************************************************************************

    service里如下寫:

    package com.sinoconcept.match.service.impl;

    import java.lang.reflect.InvocationTargetException;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;

    import org.apache.struts.util.LabelValueBean;

    import com.sinoconcept.match.dao.DirctDAO;
    import com.sinoconcept.match.service.DirctService;

    public class DirctServiceImpl implements DirctService {
    ?private DirctDAO dirctDAO;

    ?public List getDirect(String dirName) {

    ??List result = this.getDir(dirName);
    ??return result;
    ?}

    ?public List getDirectLabelValueBean(String dirName) {

    ??List result = this.getDirLableValueBean(dirName);
    ??return result;
    ?}

    ?public List getDir(String dirName) {
    ??List result = null;

    ??result = dirctDAO.loadAll(dirName);

    ??return result;
    ?}

    ?@SuppressWarnings("unchecked")
    ?public List getDirLableValueBean(String dirName) {
    ??List result = new LinkedList();
    ??List list = getDir(dirName);
    ??Iterator it = list.iterator();
    ??while (it.hasNext()) {
    ???Object obj = it.next();
    ???LabelValueBean lv = new LabelValueBean();
    ???String label = null;
    ???try {
    ????label = obj.getClass().getMethod("getName", new Class[] {})
    ??????.invoke(obj, null).toString();
    ???} catch (Exception e) {
    ????try {
    ?????label = obj.getClass()
    ???????.getMethod("getValue", new Class[] {}).invoke(obj,
    ?????????null).toString();
    ????} catch (IllegalArgumentException e1) {
    ?????// TODO Auto-generated catch block
    ?????e1.printStackTrace();
    ????} catch (SecurityException e1) {
    ?????// TODO Auto-generated catch block
    ?????e1.printStackTrace();
    ????} catch (IllegalAccessException e1) {
    ?????// TODO Auto-generated catch block
    ?????e1.printStackTrace();
    ????} catch (InvocationTargetException e1) {
    ?????// TODO Auto-generated catch block
    ?????e1.printStackTrace();
    ????} catch (NoSuchMethodException e1) {
    ?????// TODO Auto-generated catch block
    ?????e1.printStackTrace();
    ????}
    ???} finally {
    ????if (label == null)
    ?????try {
    ??????label = label = obj.getClass().getMethod("getValue",
    ????????new Class[] {}).invoke(obj, null).toString();
    ?????} catch (IllegalArgumentException e) {
    ??????// TODO Auto-generated catch block
    ??????e.printStackTrace();
    ?????} catch (SecurityException e) {
    ??????// TODO Auto-generated catch block
    ??????e.printStackTrace();
    ?????} catch (IllegalAccessException e) {
    ??????// TODO Auto-generated catch block
    ??????e.printStackTrace();
    ?????} catch (InvocationTargetException e) {
    ??????// TODO Auto-generated catch block
    ??????e.printStackTrace();
    ?????} catch (NoSuchMethodException e) {
    ??????// TODO Auto-generated catch block
    ??????e.printStackTrace();
    ?????}
    ???}
    ???lv.setLabel(label);
    ???try {
    ????lv.setValue(obj.getClass().getMethod("getId", new Class[] {})
    ??????.invoke(obj, null).toString());
    ???} catch (IllegalArgumentException e) {
    ????// TODO Auto-generated catch block
    ????e.printStackTrace();
    ???} catch (SecurityException e) {
    ????// TODO Auto-generated catch block
    ????e.printStackTrace();
    ???} catch (IllegalAccessException e) {
    ????// TODO Auto-generated catch block
    ????e.printStackTrace();
    ???} catch (InvocationTargetException e) {
    ????// TODO Auto-generated catch block
    ????e.printStackTrace();
    ???} catch (NoSuchMethodException e) {
    ????// TODO Auto-generated catch block
    ????e.printStackTrace();
    ???}
    ???result.add(lv);
    ??}
    ??return result;
    ?}

    ?public DirctDAO getDirctDAO() {
    ??return dirctDAO;
    ?}

    ?public void setDirctDAO(DirctDAO dirctDAO) {
    ??this.dirctDAO = dirctDAO;
    ?}

    }

    ***********************************************************************************************************************

    Action里面如下設置:

    String status = request.getParameter("status");
    ??if (status == null || status.equals("")) {
    ???status = "0";
    ??}

    List sttusList = dirctService
    ????.getDirectLabelValueBean("com.sinoconcept.match.domain.DrStatus");//數據字典表

    //DrStatus 數據映設文件只要二個字段:private Integer id;private String value;

    manDiaryForm.setStatus(status);

    request.setAttribute("statusList", sttusList);

    ****************************************************************************************************************

    頁面上如下獲得:

    <html:select property="status" onchange="sel()">
    ???????<html:optionsCollection name="statusList" />
    ??????</html:select>

    posted on 2006-11-16 09:44 SIMONE 閱讀(688) 評論(0)  編輯  收藏 所屬分類: struts
    主站蜘蛛池模板: 男女猛烈xx00免费视频试看| avtt天堂网手机版亚洲| 一级毛片aaaaaa视频免费看| 韩国亚洲伊人久久综合影院| 青青草a免费线观a| 亚洲人成人77777在线播放 | 久久久久久免费一区二区三区 | 久久久久无码专区亚洲av| 国产亚洲视频在线播放大全| 国产免费啪嗒啪嗒视频看看| 免费无遮挡无遮羞在线看 | 国内精品99亚洲免费高清| 国产免费丝袜调教视频| 2048亚洲精品国产| 你是我的城池营垒免费看| 中文字幕亚洲色图| 免费无码又黄又爽又刺激| 国产精品久久久久久亚洲影视| 免费国产精品视频| 成人免费无码H在线观看不卡| 国产一级特黄高清免费大片| 午夜在线免费视频| 亚洲AV无码一区二区乱孑伦AS| 中文字幕亚洲免费无线观看日本| 亚洲国产精品久久网午夜| 全免费a级毛片免费看无码| 午夜亚洲AV日韩AV无码大全| 特级毛片aaaa级毛片免费| 亚洲精品无码久久久久AV麻豆| 久久久精品午夜免费不卡| 久久狠狠爱亚洲综合影院| 亚洲AV无码乱码在线观看| 蜜桃成人无码区免费视频网站 | 免费无码作爱视频| 亚洲视频国产精品| 日韩免费观看视频| 日韩电影免费在线观看中文字幕| 精品久久久久久亚洲| 福利免费观看午夜体检区| 亚洲欧洲精品国产区| 国产在线观看免费不卡|