??xml version="1.0" encoding="utf-8" standalone="yes"?> 如果仅仅是查找数据库中name不重复的字段Q很Ҏ 但是q样q不能得到说有重复字D늚id倹{(只得C最的一个id| 查询哪些字段是重复的也容?/p> 但是要一ơ查询到重复字段的id|必M用子查询了,于是使用下面的语句来实现MySQL大表重复字段查询?/p> 但是q条语句在mysql中效率太差,感觉mysqlq没有ؓ子查询生成零时表?/p>
于是使用先徏立零时表 然后使用多表q接查询 l果q次l果很快出来了?/p>
?distinct去重?/p>
]]>
BufferInputStream高输入?BufferedInputStream bi=new BufferedInputStream(in);
BufferOutputStream高输出?BufferedOutputStream out = new BufferedOutputStream(ou);
File file = new File("d:\\通知.doc");
try {
long st = System.currentTimeMillis();
InputStream in = new FileInputStream(file);
BufferedInputStream bi=new BufferedInputStream(in);
OutputStream ou=new FileOutputStream("d:\\通知11.doc ");
BufferedOutputStream out = new BufferedOutputStream(ou
);
int b = 0;
while ((b = bi.read()) != -1) { // 循环din对象的字?/span>
out.write(b); // 写入到文?/span>
}
try {
in.close();
out.flush();
out.close(); // 好习?/span>
} catch (Exception e) {
e.printStackTrace();
}
long et = System.currentTimeMillis();
System.out.print (et - st);
// System.out.println(s);
} catch (IOException e) {
e.printStackTrace();
}
}
]]>
]]>
]]>
2、tomcat4.1 tomcat5.0.28
一、安装tomcat4.1Q所有端口默认)
二、tomcat5.0.28必须为非安装版(server.xmlQ?br />
1、更?005端口Qؓ防止与tomcat4.1占用端口冲突<Server port="8005" shutdown="SHUTDOWN" debug="0">
2、找?<!-- Define a non-SSL Coyote HTTP/1.1...--> 更改port端口P此处更改为tomcatQ暂时更改ؓ8081Q?/p>
3、找?lt;!-- Define a Coyote/JK2 AJP 1.3 Connector on ...-->更改port端口P此处更改为apacheQ暂时更改ؓ8018Q?br />
三、更改apache的workers2.properties文g
[shm]
file=${serverRoot}/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
[channel.socket:localhost:8018]
port=8018
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[ajp13:localhost:8018]
channel=channel.socket:localhost:8018
# Uri
# Map All webapp to the Web server uri space
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/infoseek/*]
worker=ajp13:localhost:8009
[uri:/dataReport/*]
worker=ajp13:localhost:8018
q样apche与tomcat的整合就完成?br />
另:apche的http.conf文g DocumentRoot "D:/www" 可以指定apache目发布路径
tomcat的server.xml文g搜烦<Logger className="org.apache.catalina.logger.FileLogger".../>下加?lt;Context path="/infoseek" docBase="D:\www\webapps\infoseek" debug="0"/>可指定tomcat发布路径
]]>
]]>
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期?,
"星期一",
"星期?,
"星期?,
"星期?,
"星期?,
"星期?);
document.write(
"<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
today.getYear(),"q?,
today.getMonth()+1,"?,
today.getDate(),"?,
d[today.getDay()+1],
"</font>" );
// End -->
</script> </div></td>
]]>
public class Comminute {
public static void main(String[] args) {
String ss = "1||2||3||";
//String str1[] = ss.split("[||]");
String str1[]=ss.split("[||]{2}");
for (int i = 0; i < str1.length; i++) {
System.out.println(str1[i]);
}
System.out.println(str1.length);
}
}
22Q在部vStrutsӞ出现如下错误信息Q?br />
HTTP Status 404 - Servlet action is not available
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
问题原因Q?br />
1.、web.xml文g中未配置ActionServlet?br />
2、struts-config.xml文g未配|你要访问的Action?br />
3、你的jsp文gform标记中action属性的路径名称错误?br />
4、非以上三种情况?br />
针对以上4U情늛应的解决Ҏ如下Q?br />
1、在web.xml文g中加上ActionServlet的配|信?br />
?????? /WEB-INF/struts-config.xml?
?2、在struts-config.xml文g查你要访问的Action配置文g?br />
3、检查jsp文gform标记中action属性的路径名称是否与struts-config.xml文g中action标记的path属性的路径名称一致?br />
4、非以上情况的解军_法就是检查web容器的log日志Q如果时tomcat则检查下logs目录下的localhost_log文gQ看里边是否记录有错误信息,然后Ҏ错误信息提示其U正?/font>
23Qjava.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter
~少spring-framework-2.0.3\lib\jakarta-commons\commons-beanutils.jar
24.
ava 代码Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type
~少spring-framework-2.0.3\lib\asm\asm-2.2.2.jar?版本不同,该包的名字有相应的区?/font>
java 代码Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
~少spring-framework-2.0.3\lib\dom4j\dom4j-1.6.1.jar?版本不同,该包的名字有相应的区?br />
把这个包q去可以了Q\Spring206\lib\dom4j、dom4j-1.6.1.jar
java 代码Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
~少spring-framework-2.0.3\lib\jakarta-commons\commons-collections.jar?版本不同,该包的名字有相应的区?/font>
java 代码Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
~少spring-framework-2.0.3\lib\cglib\cglib-nodep-2.1_3.jar?版本不同,该包的名字有相应的区?/font>
java 代码Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
~少hibernate-3.2\lib\asm.jar?版本不同,该包的名字有相应的区?
java 代码
org.hibernate.exception.SQLGrammarException: could not load an entity: [www.proudsoul.xml.User#1]
JAVA工程与WEB工程包的区别:一个是asm.jar,一个是jta.jar
java 代码Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
~少spring-framework-2.0.3\lib\j2ee\jta.jar?版本不同,该包的名字有相应的区别此U错误请查相应的***.hbm.xml配置文g的配|?/font>
25,
Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence value
Caused by: org.hibernate.exception.SQLGrammarException: could not get next sequence value
原因Q没有加Sequence或者数据库的方a写错?/font>
26,
我的配置文g
<id name="id" column="id">
<generator class="native" />
</id>
然后我运行保存一条数据进?br />
The database returned no natively generated identity value
׃报这个错?br />
因ؓ你native是根据看底层数据库的能力选择identity, sequence 或者hilo中的一?br />
而我的时候id没有指定
alter table `student` change `id` `id` int auto_increment
我们把我们的表的l构小的改动一下就没问题了
27,
UpdateManager无法启动2007-08-09 15:21如果在应用程序安装过E中Q暴力中断安装程序,会出现如下状况:1.apt-get remove 和dpkg --remove 无法删除软g 2.UpdateManager无法启动3.新立得Y件包理E序无法启动
以上可能是deb损坏之类造成?br />
sudo dpkg -r sqldveloper
正在d软g包列?.. 完成
正在分析软g包的依赖关系?.. 完成
E: 软g?sqldeveloper 需要重新安装,但是我无法找到相应的安装文g?br />
解决ҎQ?.?/var/lib/dpkg/status 中把对应的段删掉
重要Q修改之前请先备?br />
在status中找C对应的包删除OK?..
28,
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
了antlr-2.7.5H3.jar?从D:\eclipse\eclipse\plugins\com.genuitec.org.hibernate.eclipse_4.1.1\myeclipse-data\3.0\lib
29,
Caused by:
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
~少Spring206\lib\j2ee\jta.jar
30,
Caused by:
java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy3] to required type [business.impl.PriceBiz] for property 'priceBiz': no matching editors or conversion strategy found
在javacM讄priceBiz时应该设|的是接口PriceBizIfQ而非实现c?/font>
18, 数组界
可能1: 在命令行后面需要加入参?
可能2:加入的参数错?br />
19, car is not mapped
可能1: 在cfg.xml中没有增加映的hbm.xml文g?lt;mapping.../>?nbsp;
20, 属性没有找?br />
可能1: hbm.xml文g中的 <property name =""> 有问? 也许是name的g对应cM的成员名不一?nbsp;
21,SQLException: 无当前连?nbsp; 可能1:在比如创建帐h没有对相应的Ҏd?lt;list>中去,比如q个没有加入:<value>newAccount</value>
<bean id="transactionAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref bean="advice"/>
</property>
<property name="mappedNames">
<list>
<value>transfer</value>
</list>
</bean>
22,SQLException: Syntax error: Encountered "table" at line 1, column 8.
可能1;执行SQL时出现冲H?可能是SQL语句中用了关键字作为变量来?比如
update order set balance=1000000;
其中order被用作表名来使用,q是错误?因ؓorder是个关键?用在order by?/font>
23, Servlet /Spring-WebMvc threw load() exception
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
jar包的冲突,spring-1.2.6.jar和spring.jar出现在一个war的目录中:JBoss/server/all/deploy/Spring-WebMvc.war/WEB-INF/lib
24, java.sql.SQLException: 当事务仍处于zd状态时Q无法关闭连接?nbsp;
25 ,
validateJarFile(/home/soft01/Tomcat/webapps/sms-token-struts/WEB-INF/lib/servlet-api.jar)
Servlet /sms-struts-tiles threw load() exception
java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
原因:在WEB-INF/lib/ 目录下有servlet-api.jar?Tomcat/common/lib目录下的servlet-api.jar冲突?把WEB-INF/lib/下的servlet-api.jar删除可以了
26,java.lang.ClassNotFoundException: org.springframework.web.struts.ContextLoaderPlugIn
Marking servlet action as unavailable
10:30:47,088 ERROR [/NetCT_OSS]:3953 - Servlet /NetCT_OSS threw load() exception
javax.servlet.UnavailableException
27,org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
~少MyEclipse/eclipse/plugins/com.genuitec.eclipse.springframework_5.5.0/data/2.0/dist/modules/spring-struts.jar
28,Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (SD0702.FK82D343CF49A4B831) violated - parent key not found
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
有可能是ID生成{略的问?我将它XML映射文gҎ<generator class="increment" />好?/p>
29,
2007-08-19 16:21:43,290 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/OSS].[action]] - Servlet.service() for servlet action threw exception
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Module#2]
java.util.ConcurrentModificationException
原因:已经有对象拥有了所选择的module,用clear(),而不是remove();
30,
ERROR [org.apache.catalina.session.ManagerBase] - IOException while loading persisted sessions: java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429
java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429
在Module中加上一个关键字:transient
31,
Caused by: java.sql.BatchUpdateException: ORA-02292: integrity constraint (SD0702.SYS_C00132664) violated - child record found
原因:有其他的表引用了该表的外?所以报q个异常,如果没有引用׃会出?/p>
32,
出现数组界的时?看看是不是@环时没有?,比如:
for(int i = 1; i<arr.length;i++)可以Ҏ
for(int i = 1; i<=arr.length;i++)
1.如果使用Ant和Junit是被报找不到test,查一下是否误用了private
出错信息Q?br />
<failure message="No tests found in test.AllTest" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: No tests found in test.AllTest
该错误有个很特别的特点,当你不通过ant来运行测试,而是通过AllTestcLq行的话Q可以正常运行。小心哦
2.如果遇到报:表名无效Q且jvm报严重错误,看看是不是用了数据库的保留关键字来做表名了,如User?/p>
3.使用ant时必d心ant的classpath它用的不是IDE的classpathQ小?
4.心下边的异常,
exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of xp.bean.Users.?" type="net.sf.hibernate.PropertyAccessException">java.lang.ClassCastException at xp.bean.UsersMetaClass1.setPropertyValues(<generated>) at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues
上次出现该错错误的原因是:
源文仉我的classcdZ个类Contact contact
而跑到mapping里却成了Set,呵呵厉害?/p>
5.H然间冒出大量的NullPointException
重新build一下看看先?/p>
6.="Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade"
7.Tapestry的出错信息:
Class com.bookshop.Hello does not implement the IPage interface.
location: context:/WEB-INF/Home.page, line 6
原因Q与昄有关的哪个javacL有从IPage家族l承?/p>
8.使用ant时给出的路径好象不允许出现空根{?/p>
9.׃使用ant时用junit做测试的话,classpath中出现j2ee.jar的话Q问题多多。例如xml格式的log文g生成不了Q莫名其妙的NullPointException{。所以我讄了两个包个包含j2ee.jarQؓ~译用;一个没?为junit?/p>
10.q行单元试Ӟ在查询返回后应马上assertNotNull()Q这样可以更快速的定位NullPointException
11.要用ResourceBundle的话Q要千万心。必ȝ日志记录下它的状态。还有该属性文件应该放在classes下面?/p>
12.当要昄M面Ӟ都被提示无效Q那么应该检查一下lib目录了,q有一些很奇怪的异常Q例如你明明可以扑ֈ一个类但是服务器却提示ClassNotDefExceptionQ那么估计是~少了该cL必须的包了。或者多了不兼容的包Q如, xdocletpd包不被struts的lib目录所兼容
13.~写clone时从Java~程思想(2nd)上学到的(732)Q?br /> .引数传递过E中会自动生别?alias)?br /> .没有局域对?local objects)Q只有局域性的(local)references?br /> .reference受范?scope)的限Ӟ对象则否?br /> .对象的寿命从来不是Java的讨?因ؓ有垃圑֛收机?
14.try catch finally的域居然是分ȝ?/p>
15.jspq的其中一个原因:charset="gb2312" {号"="的两边不允许有空根{?/p>
16.我的ZDisplaytag的简单报表解x案?br />
http://displaytag.sourceforge.net/
下蝲displaytag.jar和displaytag.tld
displaytag.jar攑֜lib目录Q而displaytag.tld攑֜WEB-INF目录Q在web.xml中ؓdisplaytag.tld声明一下?br />
<taglib>
<taglib-uri>http://displaytag.org</taglib-uri>
<taglib-location>/WEB-INF/displaytag.tld</taglib-location>
</taglib>
在jsp里用前Q加?br />
<%@ taglib uri="http://displaytag.org" prefix="display" %>
注意该Y件有个bugQ他要用的一个包common-lang.jar版本必须?.0以上?br />
如果到下面异常Q则应坚持一下是否该包的版本问题?br />
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.capitalize(Ljava/lang/String;)Ljava/lang/String;
然后可攑ֿ使用?br />
<display:column property = "xxx"/>其中xxx为对象中的带有getter的变?gt;?br />
定义表格的样子,用css定义。如
TABLE.its THEAD TR {
BACKGROUND-COLOR: #69c
}
TABLE.its TR.even {
BACKGROUND-COLOR: #def
}
在用分|Q可能会出现q种情况Q点d他页Ӟ弹出下蝲H口Q让你下载当前jsp面Q这是因Z在当前页面读取了数据的缘故。解军_法ؓ在action里读取数据而不是在jsp里。可以参?br />
http://www.displaytag.org/example-paging.jsp?d-26189-p=2
17.使用displaytagӞ在一列中攑օ多个元素
必须在display:table中定义一个id
<display:table name = "allBooks" class = "its" pagesize = "5" id = "item">
<display:column title = "操作">
<a href = "/Bookshop/admin/bookManagement.do?action=view&id=<%=((Book)item).getId()%>" target = "_blank" >查看</a>
<a href = "/Bookshop/admin/bookManagement.do?action=edit&id=<%=((Book)item).getId()%>">~辑</a>
<a href = "/Bookshop/admin/bookManagement.do?action=delete&id=<%=((Book)item).getId()%>">删除</a>
</display:column>
要在displaytag中用链接,必须具备paramIdQ否则不昄为链?br />
<display:column property = "product.name" href = "viewDetailV2.0.jsp" title = "书名" paramId="item" paramProperty="product.id"/>
可以q样使用display
<display:column property = "product.id" title = "ID"/>
其中product为对?/p>
18.<bean:write name = "xxxx" property = "xxx"/> 可以直接取到session.getAttribute()取到的东ѝ?/p>
19.实验struts-upload例子时要注意的地方:
1.If you would rather write this file to another file, please check here:
q一行要打钩
2.If you checked the box to write to a file, please specify the file path here:
在这里要重命名如Qc:\b.jpg
上传成功的话Q会出现提示 The file has been written to "c:\b.jpg"
20.Hibernate的like可以q么用:
Query query = session.createQuery("from src.persistent.Book as book where upper(book.name) like :name ");
query.setString("name", "%");
result = query.list();
21.Hibernate出现 duplicate import : className
异常也可能是因ؓ忘了为持久类在configuration中addClass?br />
22.<logic:iterate id = "author" name = "authors">
name所引用的是session里的attribute?/p>
23.如果发现要出现询问下载的情况Q有可能是因跌{的页面出C问题。试试在要蟩转到的页删掉
<%@ page contentType="text/html; charset=gb2312"%>
24.如果JSP面跌{时出C边的错误信息Q?br />
The request sent by the client was syntactically incorrect (Invalid path /web/shoppingCart was requested).
原因是struts-config的action = "x" 写成?action = "x.do"
25.在struts中,strut-config.xml中,forward时用redirect = "true"可以?do重定向ؓ.jsp
26.以后在判断相{性之前先用logger把两个值显C出来?/p>
27.从session里getAttribute后,修改q不需要重新setAttribute一ơ?/p>
28.在hibernate中用subclass是一늑承树q一个表Q仅生成个mapping?br />
每个cM必须有discrimator-value。在最上层的类中必d明:
@hibernate.discriminator column = "class"?br />
不可以将子类d到configuration里去?即不可addClass(子类))
使用Xdoclet的徏立subclass的例?该类是父c?
/**
* @hibernate.class discriminator-value = "customer"
* @hibernate.discriminator column = "class"
*/
而用joined-subclass则是一cM?也不许将子类dqconfiguration里去?br />
/**
* @hibernate.joined-subclass
* @hibernate.joined-subclass-key
* column="customer_id"
*/
如果发现生成的mapping文g中joined-subclass的key column为空Q那么可能是@hibernate.joined-subclass-keyq句没有写对?br />
用joined-subclass生成的表Q仔l看。Member extends Customer
create table Customer (
id VARCHAR2(255) not null,
name VARCHAR2(255),
description VARCHAR2(255),
primary key (id)
)
create table Member (
customer_id VARCHAR2(255) not null,
password VARCHAR2(255),
primary key (customer_id)
)
29.在junit中尽量用assertEquals代替assertTrue;
30.Hibernate
如果Child extends Parent
那么from Parent as parent 也将会将Child选出来,而from Child as child 则不会选出Parent
31.Hibernate
使用hibernate的one-to-oneӞ应该两方向都set,否则会报save NullPointException
parent.setChild(child);
child.setParent(parent);
32.Hibernate
遇到下边的异常,估计是与因ؓ外键出现了问题:
java.lang.NullPointerException
at net.sf.hibernate.persister.AbstractEntityPersister.getPropertyValue(AbstractEntityPersister.java:675)
at net.sf.hibernate.id.ForeignGenerator.generate(ForeignGenerator.java:33)
?
* @hibernate.id generator-class = "foreign"
* @hibernate.generator-param name = "property" value = "customer"
* @hibernate.one-to-one name = "custmoer" class = "src.persistent.Customer"
value的值和one-to-one 中name的gW,则会出现上边的异常。如果不昄指定name则默认取成员变量?br />
?br />
Customer a
则name = "a" 需要小心的是不是类名。所以,以后最好显C指定名字ؓ好?/p>
33.出现异常Q?br />
Exceptionobject references an unsaved transient instance - save the transient instance before flushing: src.persistent.Product
原因没有为某对象q行set讄Q?如上边的q个是某对象没有调用setProduct
34.
"xxx action = "/a" 不用.do和根目录?br />
<a href = "b.do" 需?do和根目录?/p>
35.
Caused by: java.sql.SQLException: ORA-02291: q反完整U束条g (BOOKSHOP.FK4AAEE
47687CCA6B) - 未找到父关键字
如果你觉得该做的e是出现这个问题,那么查一下,是否类的承关pdhibernate的mapping中反映了出来。joined-subclass或subclass
例如a extends b
如果持久cc 需要Set的是持久caQ那么你把b传入Q而b又没有在mapping中将父子关系反映出来的话Q就会出现该异常
36.使用DynaActionForm需要注意的问题
在struts-config声明
<form-bean name="memberloginForm" dynamic ="true" type="org.apache.struts.action.DynaActionForm">
<form-property name = "name" type = "java.lang.String"/>
<form-property name = "password" type = "java.lang.String"/>
</form-bean>
在Action里将form强制转化成DynaActionFormQ然后get("属性名")可以了
37.那位大侠能给Z个用hibernateq行分页得实际例子,学习中!
http://forum.hibernate.org.cn/viewtopic.php?t=1772
Query q = s.find(".....");
q.setFirstResult(10); // 从第11条记录开?
q.setMaxResults(100); // 取出100?
......
38.struts的validate最单实?br />
1.首先准备好错误提CZ息?br />
xxx.properties ?br />
errors.required={0} is required.(默认已有)
2.Form必须从ValidatorForml承
3.不可以重载ValidatorForm的validate函数
4.在validate.xml中ؓ你想验证的表单进行验证设计。例?br />
<form name="logonForm">
<field property="userName" depends="required">
<arg0 key="prompt.userName"/>
(该参数将在显C错误信息是从xxx.propertiesdprompt.userName,填入{}Ҏ号里Q取?。如果是arg1将填入{1}位置Q以此类推?br />
</field>
</form>
不需要在action里做M处理。只forwardp了。作为forward的目标页Q不需要Q何有关用于处理出错信息的处理?/p>
39.服务器报
The requested resource (/xxxx/xxx.htm) is not available.的很奇怪的一个的可能原因
在web.xml中定义的tldQ没有找?br />
或者是lib目录下的包太多出C问题?br />
?br />
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
如WEB-INF目录下不存在spring.tld的话Q就会报上边的错?/p>
40.
spring的xxx-servlet.xml的用SimpleFormControllerpd的类问题Q?br />
<bean id = "priceIncreaseForm" class="PriceIncreaseFormController">
<property name="sessionForm"><value>true</value></property>
<property name="beanName"><value>priceIncrease</value></property>
<property name="commandClass"><value>PriceIncrease</value></property>
<property name="formView"><value>priceIncrease</value></property>
<property name="successView"><value>hello</value></property>
<property name="productManager">
<ref bean="prodMan"/>
</property>
</bean>
q里要注意几个问题:
(1)上边的PriceIncrease是了cdQ必dclasses里存在该c,否则报:
PropertyVetoExceptionsException: 1 errors:-- ErrorCodedPropertyVetoException: message=[Failed to convert property value of type [java.lang.String] to required type [java.lang.Class] for property named 'commandClass'; nested exception is:
java.lang.IllegalArgumentException: Invalid class name [PriceIncrease]: PriceIncrease]; errorCode=[typeMismatch]
java.lang.IllegalArgumentException: Invalid class name [PriceIncrease]: PriceIncrease
(2)<property name="formView"><value>priceIncrease</value></property>
q一行必不可,priceIncrease是页面的名字Q他会是prefix + priceIncrease + suffix
如果~少该行Q则报:
javax.servlet.ServletException: Error in ModelAndView object or View resolution encountered by servlet with name 'pocketSpring': View to render cannot be null with ModelAndView [ModelAndView: materialized View is [null]; Model=[{priceIncrease=PriceIncrease@148e798, org.springframework.validation.BindException.priceIncrease=org.springframework.validation.BindException: BindException: 0 errors}]]
使用Errors的rejectValue相关问题Q?br />
rejectValue(java.lang.String field, java.lang.String errorCode, java.lang.Object[] errorArgs, java.lang.String defaultMessage)
Reject the given field of the current object, using the given error description.
当前对象指的是xxx-servlet.xml中与validatorcL联系的哪个对象?br />
W一个是Q当前对象的属性名Q必d?br />
W二个是Q将要从属性文件中d的消?br />
W三个是Q传递给所d的消息的参数Q如Q?br />
error.too-low=You have to specify a percentage higher than {0}!
W四个是Q当从属性文件中d消息不成功时Q所reject的?/p>
以后从request中读取parameter可以借用spring的RequestUtils包里?br />
getStringParameter
public static java.lang.String getStringParameter(javax.servlet.http.HttpServletRequest request,
&bsp; java.lang.String name,
java.lang.String defaultVal)
Get a string parameter, with a fallback value. Never throws an exception. Can pass a distinguished value to default to enable checks of whether it was supplied.
不会抛异?br />
Hibernate的问题:2.1rc的问?br />
INFO: cache provider: net.sf.ehcache.hibernate.Provider
net.sf.hibernate.HibernateException: could not instantiate CacheProvider:
解决办法Q?.1rc比以前的版本多需要一个包
ehcache.jar
43.static的问?br /> static函数只可以访问static成员变量?br /> 而static变量可以被Q何成员函数访问?/p>
44.
java.lang.NoClassDefFoundError: javax/transaction/Synchronization];
需要添加JTA.jar
一、eclipse中文?br />
自己M载汉化包地址如下:http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/L-3.2.1_Language_Packs-200609210945/NLpack1-eclipse-SDK-3.2.1-win32.zip
下蝲后用LINK安装方式 1、多国语a包下载成功在eclipse的安装目录内新徏一个文件夹(假设在D:)Qƈ命名?language"Q即QD:\eclipse\language 2、将解压后的语言?名ؓ"eclise")复制?language"文g夹下Q即路径为D:eclipse\language\eclipseQ注意第二个eclipse压后的文件夹名字Q?br /> eclipse的安装目录内新徏一个文件夹(假设在D:)Qƈ命名?links" Q即QD:\eclipse\links 3、在"links"文g夹下再新Z个文本文档,qؓ该文档命名ؓ"language.txt",然后再文档内~辑如下:path=D://Eclipse//language (注意Q\径分隔符׃个反斜扛l成)Q编辑完成保存后?txt后缀名改?link 4、重新启?eclipse",便成功变Z文版eclipse |
public class Deldirectory {
/**
* @param args
*/
public static void del(String filepath) throws IOException {
File f = new File(filepath);// 定义文g路径
if (f.exists() && f.isDirectory()) {// 判断是文件还是目?br />
if (f.listFiles().length == 0) {// 若目录下没有文g则直接删?br />
f.delete();
} else {// 若有则把文g放进数组Qƈ判断是否有下U目?br />
File delFile[] = f.listFiles();
int i = f.listFiles().length;
for (int j = 0; j < i; j++) {
if (delFile[j].isDirectory()) {
del(delFile[j].getAbsolutePath());// 递归调用delҎq取得子目录路径
}
delFile[j].delete();// 删除文g
}
}
del(filepath);// 递归调用
}
}
public static void main(String[] args) {
try {
Deldirectory.del("d:\\sellindex");
} catch (IOException e) {
e.printStackTrace();
}
}
}