??xml version="1.0" encoding="utf-8" standalone="yes"?> 1. ECMAscript基础 $ 变量q?; 匈牙利类型标C?: var iOuouValue=100; $ l束行分h无都可以; 但再 onsubmit="javascript:function();return false;" $ 关键?; 提别注意 "constructor" bean.constructor //print bean function(){ .... } "typeof" var test=1; alert(typeof testX); //output "undefined" "NaN" - not a number -> isNan("blue"); //output "true" ->isNan("123"); //output "false" $ 对象; var o = new Object(); var a = {} q里特别说明?我们普通写?一?function 是一?object q ?var a = {name:"刘凯?} {同?var a = function(){this.name="刘凯?font size="4">"}; 来个 {name:"test",pass:"123456",addr:"bj"} //q是什?Q! json ?var str = '{name:"test",pass:"123456",addr:"bj"}' var objectBean = eval(str); //q里是 对象 objectBea.name 使用?/font>
域概念: 为面向对象做基础Q?/b>object prototype cd的对象应用?a id="vgou" title="参?>参?/a> $ arguments ; function getFun(){alert(arguments.length);} ; getFun("xx") //output 1 getFun("xx",23) //output 2 $ 语句 ;Ҏ说明?for for(var i=0i<iCount;i++) ?for( attr in object ) ; 如果无聊 你可?for( sProp in window ){alert(sProp+"你丫点啊Q?);} //看看 javascript 的反?br /> 面向对象Q?/b> var bean = new Bean(); 1.工厂Ҏ function getAttr(){ alert(this.attr) } function Bean(tattr){ var bean = new Object; bean.attr = tattr; bean.getAttr = getAttr; return bean ; } Ҏ是山寨?面向对象 2.构?/b> function Bean(tattr){ this.attr = tattr ; bean.getAttr = function(){ alert(this.attr); } } 其上 2 ?再Bean 对象创徏ӞҎ?“重复生成函数”! 3.原型模式 function Bean(){} Bean.prototype.attr = ""; Bean.prototype.getAttr=function(){alert(this.attr);} 解决 “重复生成函数?问题Q但新的问题 Bean.prototype.getArray = new Array(); ?new 对象 bean1 ?bean2 都会׃n new Array I间(是我们不想看到的) 4.混合 模型 :) 哈哈 function Bean(){ this.attr= ""; this.getArray=new Array; } Bean.prototype.getAttr=function(){alert(this.attr);} 5.动态原?Q注意下面开始,是真正的面向对?/span>Q!Q) function Bean(){ this.attr= ""; //classload 加蝲 ?br /> if(typeof Bean._initialized == "undefined" ){ Bean.prototype.getAttr=function(){alert(this.attr);}; Bean._initialized= true ; } } /****************************************************************/ 对象l承 1.对象冒充Q!(可支持多l承Q山寨很强大) function classA(sstr){ this.color = sstr ; this.sayColor = function(){ alert(this.color); }; } function classC(){} function classB(){ this.newMethod =ClassA ; this.newMethod(); delete this.newMethod ; this.newMethod =ClassC ; this.newMethod(); delete this.newMethod ; this.arrt = "google"; } 2.call() apply() 也山? function classA(sstr){ this.color = sstr ; this.sayColor = function(str){ alert(str+this.color); }; } function classB(){ // this.newMethod =ClassA ; // this.newMethod(); // delete this.newMethod ; classA.call(this,"red"); //classA.apply(this,new Array("red")) this.arrt = "baidu"; }
错误-1Q?>build.xml:95: ./jdbc not found.
解决办法-1Q?$>mkdir ./jdbc
3. $>ant junit
错误-2Q?
./build.xml:124: The following error occurred while executing this line:
./build.xml:126: The following error occurred while executing this line:
./common-build.xml:349: .\src\filters\hsqldb.filter as it doesn't exist.
解决办法-2Q?br /> $>mkdir ./src/filters ;
$>echo "" > ./src/filters/hsqldb.filter;
4. $>ant junit
错误-3Q?br /> ./build.xml:124: The following error occurred while executing this line:
./build.xml:126: The following error occurred while executing this line:
./common-build.xml:351: .\src\test-resources not found.
$>mkdir ./src/test-resources ;
5. $>ant junit
错误-4Q没有ant 错误了!Q但试都ؓ错误Q那我们q?W一个测试吧Q找下原因!
test-resources:
[mkdir] Created dir: hibernate-anntations-3.4.0.GA\build\test-reports\hsqldb
[echo] Running against db: hsqldb
[junit] Running org.hibernate.test.annotations.ConfigurationTest
[junit] Tests run: 7, Failures: 0, Errors: 6, Time elapsed: 1.218 sec
.............
$>find . -name "ConfigurationTest.java" #pwd /hibernate-anntations-3.4.0.GA
./test/org/hibernate/test/annotations/configuration/ConfigurationTest.java
./test/org/hibernate/test/annotations/ConfigurationTest.java
Ҏ路径 org.hibernate.test.annotations.ConfigurationTest
gvim ./test/org/hibernate/test/annotations/ConfigurationTest.java
发现W?0? cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
感觉应该没有配置 jdbc
gvim ./test/org/hibernate/test/annotations/hibernate.cfg.xml #果然 没配|?br /> 我这放个我的简单配|上?使用 hbm hsqldb 内存数据库测 ?)Q?br />
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:mem:hbn_ann</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<mapping resource="org/hibernate/test/annotations/Boat.hbm.xml"/>
<mapping package="org.hibernate.test.annotations"/>
<mapping class="org.hibernate.test.annotations.Plane"/>
</session-factory>
</hibernate-configuration>
我这是要hsqldb吧,既然上面错误1?jdbc 文g夹,那就是放 jdbc jar 的地?
$> cp ../hsqldb.jar ./jdbc
6. $>ant junit
呵呵 试 W一个正了 Q?Q目前配|后Q测试环境ƈ不是全部都正,比如W?个测试)
其他试错误日志在 ?.\build\test-reports\hsqldb ...
比如W?个错?异常部分
org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:256)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:234)
........ 大家一边学习,一辚w|测?环境吧?br /> 错误日记 都会?build\test-reports\hsqldb?/b>
]]>
http://tech.ddvip.com/2008-12/122835390597191.html
面可以直接q行Q?br />
<head>
<style type="text/css">
.box1 {
float:left;
width:21px;
height:21px;
position:relative;
background: #F3F2E2 url(http://mp3.youdao.com/images/mbox_bg.gif) no-repeat;
}
.box1 {
background-position: 0px -60px;
}
</style>
</head>
<body>
<div class="box1"
onmouseover="this.style.backgroundPosition='0px -81px' "
onmouseout="this.style.backgroundPosition='0px -102px' "
>
</div>
</body>
</html>
]]>
核心QECMAscriptQGlobal 内置对象Q?br />
ҎQ?parseInt(),isNan(),encodeURI()...{都为此对象Ҏ
特别注意 eval();动态语a的象?比如Qeval("alert('hi')"); 但这个方法很邪恶Q安全方面)
文本对象(DOM)说明Q?br /><bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
</bookstore><SCRIPT type=text/javascript>
var sMessage = 'Hello';
function setSomething() {
sColor = 'red';
sMessage = 'Hello World!';
}
setSomething();
alert(sMessage); //Hello World!
alert(sColor); //red
</SCRIPT><SCRIPT type=text/javascript>
var sMessage = 'Hello';
function setSomething() {
var sColor = 'red';
sMessage = 'Hello World!';
}
setSomething();
alert(sMessage); //Hello World!
alert(sColor); // 什么都没有
</SCRIPT><SCRIPT type=text/javascript>
var sMessage = 'Hello';
function setSomething() {
var sColor = 'red';
var sMessage = 'Hello World!';
}
setSomething();
alert(sMessage); //Hello
alert(sColor); // 什么都没有
</SCRIPT>// 最单的 l承
Object.prototype.inObj = 1;
function A()
{
this.inA = 2;
}
A.prototype.inAProto = 3;
B.prototype = new A; // Hook up A into B's prototype chain
B.prototype.constructor = B;
function B()
{
this.inB = 4;
}
B.prototype.inBProto = 5;
x = new B;
document.write(x.inObj + ', ' + x.inA + ', ' + x.inAProto + ', ' + x.inB + ', ' + x.inBProto);
//1, 2, 3, 4, 5
//增加点信?http://www.json.org/json.jsObject.prototype.toJSONString = function (filter) {
return JSON.stringify(this, filter);
};
后我们就可以使用 bean.toJSONString()不是吗?
this.getArray=new Array;
3.正统的?原型?/b> (但不支持多?
function classA(){this.oo="test";}
classA.prototype.color = "red";
function classB(){}
classB.prototype = new classA ;
classB.prototype.sayName = function(){
alert( this.color );
}
var bb = new classB ;
bb.sayName(); // output red
alert(bb.oo); // output test
alert( bb instanceof classA); //output true
alert( bb instanceof classB); //output true
4.如果你要多承!Qƈ且还支持 instanceof
混合方式Q?br /> function classA(){}
function classB(){}
function classC(){
classA.call(this);
classC.call(this);
}
classC.prototype = new classA ;//注意 q?instanceof 只能?A有用
]]>
下蝲Qflash-plugin-10.0.15.3-release.i386.rpm
rpm -ivh flash-plugin-10.0.15.3-release.i386.rpm
]]>
tomcat > server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="D:/workspace/meganotes/mn_mod_admin/target/mn_mod_admin/" path="/" />
。。。?br />
关键Q在Context上不要加reloadable和debug属?
然后 使用eclipse tomcat 调试
ok