姿姿霸霸~~!
贵在坚持!
posts - 47,  comments - 35,  trackbacks - 0
在web.xml,要对2个框架的分发,分别配置不同的url-pattern!!!
posted @ 2009-04-20 16:58 sure_xx 阅读(99) | 评论 (0)编辑 收藏
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;
        }

    }
posted @ 2009-04-18 20:14 sure_xx 阅读(57) | 评论 (0)编辑 收藏
new java.text.DecimalFormat("0.00").format(xxx);
posted @ 2009-04-08 12:41 sure_xx 阅读(50) | 评论 (0)编辑 收藏

在web.xml中加入

<mime-mapping>   
    <extension>xls</extension>   
    <mime-type>application/excel</mime-type>  
</mime-mapping>

服务器端同时安装上Excel

posted @ 2009-03-26 10:29 sure_xx 阅读(93) | 评论 (0)编辑 收藏
     摘要: 1.用spring的mail发邮件需要将j2ee包里的mail.jar和activation.jar引入 2.遇见的异常可能会有    (1)java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream    (2)java.lang.NoClassDefFoundErro...  阅读全文
posted @ 2008-10-18 16:18 sure_xx 阅读(1372) | 评论 (4)编辑 收藏
    <!-- 配置事务开始 -->
    
<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>
    
    
<!-- 配置事務結束 -->

使用事务的时候,在DAO就不要用try{}catch{}了,因为在catch里面捕获的异常,spring的事务貌似不能去回滚
posted @ 2008-10-15 22:47 sure_xx 阅读(83) | 评论 (0)编辑 收藏
今天做了个aop的试验,对于springmvc的action不能拦截成功,研究了很久,没有找到问题,所以请教下大家.
下面是代码:

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页面
    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>
    当前时间是:
<%=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--执行类:"+joinPoint.getThis()+""+joinPoint.getSignature().getName()+"方法之后");
    }


    
public void beforeTest(JoinPoint joinPoint) {
    System.out.println(
"aop--执行类:"+joinPoint.getThis()+""+joinPoint.getSignature().getName()+"方法之前");
    }


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


}

4.xml关于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>
posted @ 2008-09-22 23:19 sure_xx 阅读(1375) | 评论 (10)编辑 收藏
1.String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
    return this.replace(/(^\s*)/g, "");
}
String.prototype.Rtrim = function()
{
    return this.replace(/(\s*$)/g, "");
}

2.全文匹配替换
var regExp = new RegExp("需要被替换的字符',"g")
var text = "…………";
text = text.replace(regExp , "替换的字符");

3.方案
String .prototype.trim = function(){
   var matches = this.match(/^[ \t\n\r]+/);
   var prefixLength = (matches == null) ? 0:matches[0].length;
   matches = this.match(/[ \t\r\n]+$/);
   var suffixLength = (matches == null) ? 0:matches[0].length;
   return this.slice(prefixLength,this.length-suffixLength);
}
posted @ 2008-08-27 16:12 sure_xx 阅读(757) | 评论 (0)编辑 收藏
1.写文件并设置encoding
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("GBK");
output = new XMLWriter(new FileWriter(new File(filename)), format);
output.write(document);

2.先删文件再创建

File file = new File("d://xxx.xml");
  if(file.exists()){
   file.delete();
  }

CreatXml temp = new CreatXml();
temp.createXMLFile("d://xxx.xml")

posted @ 2008-08-20 23:50 sure_xx 阅读(207) | 评论 (0)编辑 收藏
重新给sys设计一个新口令
sqlplus /nolog
connect / as sysdba
alter user sys identified by '新口令';


给scott解锁:
alter user scott account unlock;
posted @ 2008-08-19 23:33 sure_xx 阅读(146) | 评论 (1)编辑 收藏
仅列出标题  下一页

<2009年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

留言簿(3)

随笔分类

随笔档案

好友的blog

搜索

  •  

积分与排名

  • 积分 - 16587
  • 排名 - 671

最新评论

阅读排行榜

评论排行榜