Life is not do what you like, but like what you d
歪酷博客
日 历
今日天气
网志文件夹
· 所有网志
最 新 的 评 论
搜 索
友 情 链 接
· 歪酷博客
· 管理我的Blog
· Ben的快乐人生
· BenBing

订阅 RSS

0185381

歪酷博客

Soon @ 2009-10-26 15:18

为了生存而挤在这喧嚣的城市,内心却渴望宁静的山间田园~

不要认为山间田园的生活会压垮人的脊梁; 真正罪魁祸首是人的欲望~

无欲则刚~

向承载我们的母体索取的越多,我们的生活越难堪~

人的欲念实在太强烈,榨干母体最后一滴血液后仍无法得到满足吧?

这宇宙间可有无欲无求的世外桃源~

让我们过一回真正的生活!


 
Soon @ 2005-06-30 11:00

编程教训:
1、char(2)型的字段,作比较:如 "a "(后面要加个空格来填满)

2、DownPage downPage = new DownPage();
  downPage.setUrl(tempUrl);    
如果tempUrl中有空格,则空格后的url被忽略。


 
Soon @ 2005-06-30 10:52

struts:<html:hidden...>

<html:hidden property="oracleCode" value=""/>

去掉value=""  ,否则actionform的setOracleCode()不起作用!!



struts:<html:link href="#" onclick="">test</html:link>



struts:can't use form.setXXX to init

*reason:in html,you may be use this <html:text property="name" value=""/>,
please get rid of  --value="" -- !



struts:关于upload中文乱码
struts不支持utf8中文名字文件上传 ,
解决方法:把文件格式转换成 ascII   ,charset 改为 gb2312 ,即可;
         但是在solaris机器上此方法无效。



struts:奇怪!!
1. <html:text ...... disabled="true">
then i can't use form -- getXXX to get value.
因为已经disable了控件。



struts:提交action
document.forms[0].action="/kjmng/do/YK1G1010Show";
document.forms[0].submit();

to submit the form with this way must use the whole path : /kjmng/do/YK1G1010Show,not /YK1G1010Show!!!


 
Soon @ 2005-06-30 10:50

oracle : synonym
用sql语句修改synonym,synonym和原table都有效。




oracle: char(2)
定义为char(2)的字段,如果值只有一个字符,数据库会自动加上一个空格,使用时用trim() ------ 但不影响查询。



oracle:create a sequencetable--MTC_charge_report.no)

create sequence MTC_charge_report_no increment by 1 start with 1 maxvalue 99999 cycle nocache




oracle:decode
decode(a.cost_type_id,'1','SERVICELABOR','3',a.MITAC_PN) MITAC_PN

如果cost_type_id为1,则mitac_pn值为‘servicelabor’;
如果cost_type_id为3,则mitac_pn值为a.mitac_pn;




oracle:line_code||'('||line_name||')'

"||"-----oracle的连接符号。




oracle:pl/sql error:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1

在字段appr_req_type前加上 nvl() 即可解决:
MSS_UTIL.get_codename('Service Type',nvl(appr_req_type,'a'))rma_type




oracle:to_date() 不能用在本身为date的数据上。





oracle:to_number(to_char(SUM(total*(1+vat*0.01)),'9999999999.99'))




oracle:trunc()
date = 2005-5-31 15:48:12

trunc(date,'dd') --> 2005-5-31
trunc(date,'mm')--> 2005-5-1
......





oracle:建立数据库连接 & ResultSet
 public static String DB_ClassName="oracle.jdbc.driver.OracleDriver";
 public static String DB_URL="jdbcracle:thin:@10.83.2.193:1521:tyaned";

     Class.forName(DB_ClassName) ;
     conn=DriverManager.getConnection(DB_URL,dbname,dbpass);
     stmt= conn.createStatement();
     //执行
     ResultSet result =stmt.executeQuery(sql);
     ResultSetMetaData resultMeta = result.getMetaData();




oracle:日期函数
ADD_MONTHS(d,n) 日期值加n月
LAST_DAY(d) 返回当月的最后一天的日期
MONTHS_BETWEEN(d1,d2) 两个日期值间的月份,d1<d2 返回负数
NEXT_DAY(d) 返回日期值下一天的日期
…………………………………………………………………………………………
ROUND(n,m)   按m的位数取四舍五入值如果round(日期): 中午12以后将是明天的日期. round(sysdate,'Y')是年的第一天


 
Soon @ 2005-06-30 10:48

jsp:customer adjust table format

<%@ page import = "com.mitac.html.table.ReportTable" %>
<% ReportTable aTable = new ReportTable();%>
<table  width=300% border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF">
   <tr><td colspan="24" class="Headerleft">MioRegQuery系统</td></tr>
<%=aTable.printTbodyBegin("StatTable0",0,0)%>
......
<%out.println(aTable.printTbodyEnd());%>
</table>





jsp:download成excel,word

在文件开头加上:<%@ page contentType="application/vnd.ms-excel;charset=UTF-8" %>
vnd.ms-excel  ||  msword

note:内含table的,width不能用百分数,如:100%

//以下转成pdf的写法没有用,要用itext实现download成pdf
application/pdf
application/x-pdf
application/acrobat
applications/vnd.pdf
text/pdf
text/x-pdf

********************************************************************************************
download成excel,if the value is String like a long number,it shows with 科学计数法 by deafult;

-------------------To resolve it by adding a '&nbsp;' before html code!!!



jsp:Hashtable[ ] result1...
<input type="hidden" name="result1" value="<%=result1%>">  //wrong!!!

用input好像无法保存一个hashtable值?



jsp:refresh
<META content="8; URL=/WEB/M3000/M3300/M3344_rmaList.jsp" http-equiv=Refresh>



jsp:request.setAttribute();
在jsp里面,要用:
<jsp:forward page="M6230_showPics.jsp">
 <jsp:param name="rmano" value="<%=rmano%>"/>
</jsp:forward>



jsp:to set attributes in Action,and then redirect to a jsp,it works successfully.
such as:
          httpServletRequest.setAttribute("DB_message","error.noId");
          return actionMapping.findForward("sysface");

but it doesn't work when I setting attributes in jsp,and then posting it to Action.




jsp:upload中文乱码:

把utf8转成"ISO-8859-1",try!




jsp:传参数给servlet:
<form action="/itextservlet?quoteno=QUO22231110" method="post">   
如果参数直接带在servlet后面,一定要用post!!!




jsp:页面no cache:

response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);

html:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT=0>




jsp:在getParameter之前,定义以避免乱码

request.setCharacterEncoding("UTF-8");