亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2843 | 回復(fù): 0
打印 上一主題 下一主題

[WebLogic] Weblogic下使用jsp查詢的Entity Bean [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-04-15 00:09 |只看該作者 |倒序?yàn)g覽
  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@ page import="baisha.*"%>
  3. <%@ page import="javax.naming.*"%>
  4. <%!
  5.   private javax.naming.Context getInitialContext() throws Exception {
  6.     String url = "t3://localhost:7001";
  7.     String user = null;
  8.     String password = null;
  9.     Properties properties = null;
  10.     try {
  11.       properties = new Properties();
  12.       properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
  13.       properties.put(Context.PROVIDER_URL, url);
  14.       if (user != null) {
  15.         properties.put(Context.SECURITY_PRINCIPAL, user);
  16.         properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
  17.       }

  18.       return new InitialContext(properties);
  19.     }
  20.     catch(Exception e) {
  21.       System.out.println(e.getMessage());
  22.       return null;
  23.     }
  24.   }

  25. %>
  26. <html>
  27. <head>
  28. <title>
  29. Jsp1
  30. </title>
  31. </head>
  32. <body>
  33. <%
  34. //Properties env =new Properties();
  35. // env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
  36. // env.put(Context.INITIAL_CONTEXT_FACTORY,"t3://localhost:7001");
  37. //Context ctx = new InitialContext(env);
  38. String str_id=null;
  39. str_id =request.getParameter("id");
  40. javax.naming.Context ctx = new javax.naming.InitialContext();
  41. Object ref = ctx.lookup("Province");
  42. baisha.ProvinceHome provHome =null;
  43. baisha.Province prov = null;
  44. provHome = (baisha.ProvinceHome)javax.rmi.PortableRemoteObject.narrow(ref,ProvinceHome.class);
  45. if (provHome==null) {
  46.    out.println("provHome is null");
  47. }
  48. else
  49.     {
  50.     if (str_id==null){
  51.    
  52.     }
  53.     else{
  54.       try{
  55.         prov = provHome.findByPrimaryKey(new Integer(str_id));
  56.         out.println(prov.getProvinceName());
  57.         }
  58.       catch(Exception e){
  59.        out.println("ID 不存在!");
  60.       }  
  61.     }
  62.     }
  63.   
  64.      
  65. %>
  66. <h1>
  67. JBuilder Generated JSP
  68. </h1>
  69. <form method="post" action="query.jsp">
  70. <br>Enter new value   :  <input name="id"  type="text"><br>
  71. <br><br>
  72. <input type="submit" name="Submit" value="Submit">
  73. <input type="reset" value="Reset">
  74. <br>

  75. </form>
  76. </body>
  77. </html>
復(fù)制代碼
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP