ApplicationContext application = new ClassPathXmlApplicationContext("classpath:helloword/application.xml");
datasouce = (DataSource) application.getBean("ARDataSource");
DB_Conn = datasouce.getConnection();
// 設定 CallableStatement
cs = DB_Conn.prepareCall("{call Tn_Pg_Wunhowchien.Tn_Pc_Test(?, ?, ?,?)}");
// 設定 IN參數的 Index 及值
cs.setString(1, "test1");
// 定義 OUT 參數的 Index 與型態
cs.registerOutParameter(2, OracleTypes.CURSOR);//import oracle.jdbc.OracleTypes;
cs.registerOutParameter(3, OracleTypes.VARCHAR);
cs.registerOutParameter(4, OracleTypes.VARCHAR);
// 執行並取回 OUT 參數值
cs.execute();
System.out.println(cs.getString(3));
System.out.println(cs.getString(4)); // OUT 回傳值
ResultSet list= (ResultSet) cs.getObject(2);
if(list.next()){
System.out.println(list.getString("Area_Cde"));
System.out.println(list.getString("Phone_Nbr"));
}
資料來源:mkyong.com
2012年4月17日 星期二
callable StoreProcedure
標籤:
JAVA
springConnectionConfig
<!-DriverManagerDataSource建立連結是只要有連接就建一個connection,無連接池作用-->
<bean id="pkmDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>${pkm.jdbc.driverClassName}</value>
<!--${pkm.jdbc.driverClassName}是jdbc.properties文件 中的key-->
</property>
<property name="url">
<value>${pkm.jdbc.url}</value>
</property>
<property name="username">
<value>${pkm.jdbc.username}</value>
</property>
<property name="password">
<value>${pkm.jdbc.password}</value>
</property>
</bean>
<bean id="pkmDataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="false">
<property name="driverClassName" value="${pkm.jdbc.driverClassName}"/>
<property name="url" value="${pkm.jdbc.url}"/>
<property name="username" value="${pkm.jdbc.username}"/>
<property name="password" value="${pkm.jdbc.password}"/>
<property name="initialSize" value="5"/>
<property name="maxActive" value="10"/>
<property name="maxWait" value="60000"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
<bean id="DataSourceA"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>DS1</value>
</property>
</bean>
2012年4月16日 星期一
Weblogic domain 新建伺服器
1.console>環境>伺服器>正常新增serverName資料來源linushr的BLOG並給予不同port 2.專案所需jndi必需授權給新建的server 3.%base_domain\bin\底下新建一個cmd (1)http://localhost:7001 -->為主機ip (2)cmd內容 startManagedWebLogic.cmd testServer http://localhost:7001 4.執行新增的cmd
2012年4月14日 星期六
Sport Rec 2-4
| April | |
| 4/3 | 10k |
| 4/6 | 8k |
| 4/7 | 7k |
| 4/10 | 4k |
| 4/12 | 健身房1H |
| 4/14 | 跑北宜9K |
| 4/17 | 8K |
| 4/.. | 忘了記錄、約莫8K*N次就腹痛 |
| March | |
| 3/2 | 4k |
| 3/6 | 打籃球3h休息(伏地90、開合120) |
| 3/11 | 永安來回87k+桌球2.5h |
| 3/18 | 21k 國道馬拉松(2:21:5X) |
| 3/24 | 10K |
| February | |
| 2/11 | 跑10k 約一個小時前後~比魚肌酸痛 休息幾天 |
| 2/15 | 跑5k~比魚肌超酸痛...手按伺候 |
| 2/16 | 跑8k 今天跑起來不會太酸、跑2圈測試~ |
| 2/20 | 8k |
| 2/22 | 3.91 |
標籤:
Run
2012年4月13日 星期五
jQuery過濾器
資料來源KingKong Bruce記事
過濾器 |
說明 |
範例 |
|---|---|---|
:animated |
選擇正在執行動畫效果的元素 |
$(':animated')或.filter(":animated") |
:eq(index) |
等於索引值(索引從0開始) |
$(':eq(index)')或$('Selector').eq(index) |
:even |
選擇奇數索引值,會選擇元素1與元素3;即索引值的0,2,... |
$(':even')或.filter(':even') |
:first |
選擇第一個符合的元素 |
$(':first')或.filter(':first') |
:gt(index) |
大於索引值的對應元素;索引從0開始 |
$(':gt(index)')或$('Selector').slice(index) |
:header |
選擇所有h1,h2,h3,h4,h5,h6元素 |
$(':header')或.filter(':header') |
:last |
選擇最後一個符合的元素 |
$(':last')或.filter(':last') |
:lt(index) |
小於索引值的對應元素索引從0開始 |
$(':lt(index)')或$('Selector').slice(0,index) |
:not(Selector) |
排除selector內元素 |
$(':not(selector)') |
:odd |
選擇偶數索引值對應的元素;元素2,4,6,...;:odd會選擇元素2與元素3;即索引值的1,3,... |
$(':odd') |
| [name|="value"] | 選擇指定屬性等於字串值或以該字串為前綴的值(以字串後跟著一個連字符號"-")的元素。 這個過濾器是引入CSS規範來處理語言屬性。 |
$('[attribute|=value]') |
| [name*="value"] | 選擇指定屬性包含特定字串值,不論在字串中的位置。 | $('[attribute*=value]') |
| [name~="value"] | 選擇指定屬性包含特定字串值,字串用空格分隔。 | $('[attribute~=value]') |
| [name$="value"] | 選擇指定屬性的字串是以字串值結尾。 這個比較區分大小寫。 |
$('[attribute$=value]') |
| [name="value"] | 選擇指定屬性的字串等於字串值。 | $('[attribute=value]') |
| [name!="value"] | 選擇沒有指定屬性的元素,或指定屬性的字串不等於字串值。 | $('[attribute!=value]') |
| [name^="value"] | 選擇指定屬性的字串是以字串值開頭。 | $('[attribute^=value]') |
| [name] | 選擇所有具有指定屬性的元素,該屬性的字串可以是任何值。 | $('[attribute]') |
| [name="value"][name2="value2"] | 選擇符合所有指定屬性過濾器的元素 | $('[attribute1=value1][attribute2=value2]') |
選擇器 |
說明 |
範例 |
:button |
選擇button元素和type="button"的input元素 |
$(':button') |
:checkbox |
選擇type="checkbox"的input元素 |
$(':checkbox') |
:checked |
選擇已勾選(checkbox)或已選擇(radio)的input元素 |
$(':checked') |
:disabled |
選擇設定disabled屬性的input元素 |
$(':disabled') |
:enabled |
選擇未設定disabled屬性的input元素 |
$(':enabled') |
:focus |
選擇目前焦點所在的元素,注意,不限於input元素 |
$(':focus') |
:file |
選擇type="file"屬性的input元素 |
$(':file') |
:image |
選擇type="image"屬性的input元素 |
$(':image') |
:input |
選擇input、textarea、select、button元素 |
$(':input') |
:password |
選擇type="password"屬性的input元素 |
$(':password') |
:radio |
選擇type="radio"屬性的input元素 |
$(':radio') |
:reset |
選擇type="reset"屬性的input元素 |
$(':reset') |
| :selected |
選擇所有option元素裡被選擇項目 |
$(':selected') |
:submit |
選擇button元素與type="submit"屬性的input元素 |
$(':submit') |
:text |
選擇type="text"屬性的input元素 |
$(':text') |
標籤:
Jquery
2012年4月12日 星期四
Sturt2 ZeroConfing
資料來源struts-2-hello-world-annotation-example
ZeroConfig 的InterCeptor還是要配sturts.xml
@Namespace("/User")//nameSpace很重要 沒設好mapping不到
@ResultPath(value="/")
@Result(name="success",location="pages/login.jsp")
public class LoginAction extends ActionSupport{
@Action(value="testLogin", results={
@Result(name="success",location="pages/test.jsp")
})
public String test() {
return SUCCESS;
}
@Action(value="testLogin2", results={
@Result(name="success",location="pages/test2.jsp")
})
public String test2() {
return SUCCESS;
}
}
ZeroConfig 的InterCeptor還是要配sturts.xml
@Action(value="store", interceptorRefs=@InterceptorRef("store"))
public String store() throws Exception
{
....
}
標籤:
Sturts2
JavaScript 連Oracle 10.3
尚未使用過Jsp 連結Oracle 記錄備查
jsp需引進import="java.sql.*,oracle.jdbc.*"
ResultSet rs = null;
String oracleURL="jdbc:oracle:thin:@IP位置:PORT:SID";
String oracleUser="*****";
String oraclePWD="*****";
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
}catch (SQLException e){
out.print("Driver Error");
}
try {
Connection conn = DriverManager.getConnection(oracleURL,oracleUser,oraclePWD);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select sysdate from dual");
while(rs.next()) {
%>
now :<%=new String(rs.getString(1)) %>
<%
}
out.print("connection Success !!!");
stmt.close();
conn.close();
}catch (SQLException ce){
System.out.print(ce);
}
jsp需引進import="java.sql.*,oracle.jdbc.*"
ResultSet rs = null;
String oracleURL="jdbc:oracle:thin:@IP位置:PORT:SID";
String oracleUser="*****";
String oraclePWD="*****";
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
}catch (SQLException e){
out.print("Driver Error");
}
try {
Connection conn = DriverManager.getConnection(oracleURL,oracleUser,oraclePWD);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select sysdate from dual");
while(rs.next()) {
%>
now :<%=new String(rs.getString(1)) %>
<%
}
out.print("connection Success !!!");
stmt.close();
conn.close();
}catch (SQLException ce){
System.out.print(ce);
}
標籤:
JavaScript,
Oracle
2012年4月10日 星期二
Sturt2 Iterceptor
Java Inteceptor
@Override public String intercept(ActionInvocation invocation) throws Exception { java.util.Map<String,Object> session = invocation.getInvocationContext().getSession(); if(session.isEmpty()) return "session"; // session is empty/expired return invocation.invoke(); }sturs.xml 引用方式
<interceptors> <interceptor name="timeouthandle" class="com.taiwanmobile.ebg.util.SessionIterceptor" /> <interceptor-stack name="sessionExpirayStack"> <interceptor-ref name="timeouthandle" /> <interceptor-ref name="defaultStack" /> </interceptor-stack> </interceptors> <default-interceptor-ref name="sessionExpirayStack" /> <global-results> <result name="global-exception">/generalError.jsp</result> <result name="sql-exception">/SqlError.jsp</result> <result name="session">/timeoutError.jsp</result> </global-results> <global-exception-mappings> <exception-mapping result="global-exception" exception="java.lang.Exception"> </exception-mapping> <exception-mapping result="sql-exception" exception="java.sql.SQLException"> </exception-mapping> </global-exception-mappings> <action name="helloInit" method="insertInit" class="test.testAction"> <interceptor-ref name="sessionExpirayStack" /> <result name="success">/qs/EBGQS100I1.jsp</result> </action>
標籤:
Sturts2
訂閱:
意見 (Atom)