改動(dòng)之前:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = sure1212)(PORT = 1521))
)
)
在netmanager中添加數(shù)據(jù)庫(kù)的監(jiān)聽(tīng)
改動(dòng)之后:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = TEST.SURE)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = sure1212)(PORT = 1521))
)
)
1.
SQL> drop user sysman cascade;
用戶已刪除。
SQL> drop role MGMT_USER;
角色已刪除。
SQL> drop user MGMT_VIEW cascade;
用戶已刪除。
SQL> drop public synonym MGMT_TARGET_BLACKOUTS;
同義詞已刪除。
SQL> drop public synonym SETEMVIEWUSERCONTEXT;
同義詞已刪除。
2.emca -deconfig dbcontrol db -repos drop
3.emca -config dbcontrol db -repos create

/**
* 按照指定長(zhǎng)度將字符串進(jìn)行分割,中文字符算2個(gè)長(zhǎng)度
* @param str 字符串
* @param length 指定長(zhǎng)度
* @return 如果字符串長(zhǎng)度超出指定長(zhǎng)度
* ,則將字符串分成2個(gè)部分,分別裝在map中
*/

public static Map getStr(String str, int length) {
HashMap hashMap = new HashMap();
String addr1 = "";
String addr2 = "";

byte tmpBytes[] = str.getBytes();
int iByteLen = tmpBytes.length;

if (iByteLen > length) {
int iLen = 0;

for (int i = 0; i < length; i++) {

if ((tmpBytes[i] & 0xFF) > 0x80) {
iLen += 2;
i++;
continue;

} else {
iLen += 1;
continue;
}
}

addr1 = new String(tmpBytes, 0, iLen);
addr2 = new String(tmpBytes, iLen, iByteLen - iLen);

} else {
addr1 = str;
}
hashMap.put(new Integer(1), addr1);
hashMap.put(new Integer(2), addr2);
return hashMap;
}

0x80等于十進(jìn)制的128,Turbo C中規(guī)定對(duì)ASCII碼值大于0x80的字符將被認(rèn)為是負(fù)數(shù)。
在web.xml,要對(duì)2個(gè)框架的分發(fā),分別配置不同的
url-pattern!!!

public String getOriginalFilename(String filePath) {
String filename = filePath;

if (filename == null) {
return "";
}
int pos = filename.lastIndexOf("/");

if (pos == -1) {
pos = filename.lastIndexOf("\\");
}

if (pos != -1) {
return filename.substring(pos + 1);

} else {
return filename;
}
}
new java.text.DecimalFormat("0.00").format(xxx);
在web.xml中加入
<mime-mapping>
<extension>xls</extension>
<mime-type>application/excel</mime-type>
</mime-mapping>
服務(wù)器端同時(shí)安裝上Excel
摘要: 1.用spring的mail發(fā)郵件需要將j2ee包里的mail.jar和activation.jar引入
2.遇見(jiàn)的異常可能會(huì)有
(1)java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
(2)java.lang.NoClassDefFoundErro...
閱讀全文
<!-- 配置事務(wù)開(kāi)始 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="update*"/>
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="testTxAop"
expression="execution(* com.sure.demo.dao.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="testTxAop" />
</aop:config>
<!-- 配置事務(wù)結(jié)束 -->
使用事務(wù)的時(shí)候,在DAO就不要用try{}catch{}了,因?yàn)樵赾atch里面捕獲的異常,spring的事務(wù)貌似不能去回滾
今天做了個(gè)aop的試驗(yàn),對(duì)于springmvc的action不能攔截成功,研究了很久,沒(méi)有找到問(wèn)題,所以請(qǐng)教下大家.
下面是代碼:
1.springmvc的action:
package com.sure.demo.web;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;


public class DemoTestAction extends MultiActionController {

//返回的test頁(yè)面
private String testPage;

public String getTestPage() {
return testPage;
}


public void setTestPage(String testPage) {
this.testPage = testPage;
}




/**
* test入口
* @param request
* @param response
* @return
* @throws Exception
*/
public ModelAndView test(HttpServletRequest request,

HttpServletResponse response) throws Exception {
ModelAndView mav = null;
mav = new ModelAndView(this.getTestPage());
request.setAttribute("test", new Date().toString());
return mav;
}
}
2.jsp代碼:

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>

<%
String test = (String)request.getAttribute("test");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
當(dāng)前時(shí)間是:<%=test %> <br>
</body>
</html>

3.aop代碼:
package com.sure.aopdemo;

import org.aspectj.lang.JoinPoint;


public class AopDemoTestImpl {


public void afterTest(JoinPoint joinPoint) {
System.out.println("aop--執(zhí)行類(lèi):"+joinPoint.getThis()+"的"+joinPoint.getSignature().getName()+"方法之后");
}


public void beforeTest(JoinPoint joinPoint) {
System.out.println("aop--執(zhí)行類(lèi):"+joinPoint.getThis()+"的"+joinPoint.getSignature().getName()+"方法之前");
}


public void exceptionTest() {
System.out.println("aop方法異常");
}

}
4.xml關(guān)于aop的配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="aopDemoTestImpl" class="com.sure.aopdemo.AopDemoTestImpl"></bean>
<aop:config>
<aop:aspect id="test" ref="aopDemoTestImpl">
<aop:pointcut id="a" expression="execution(* com.sure.demo..*.*(..))"/>
<aop:before method="beforeTest" pointcut-ref="a"/>
<aop:after method="afterTest" pointcut-ref="a"/>
<aop:after-throwing method="exceptionTest" pointcut-ref="a"/>
</aop:aspect>
</aop:config>
</beans>