2012年4月7日
#
摘要: 此法則適合所有語言,咱們以JavaScript和Java兩個角度分析一下這個東東。 一、javascript 有這樣的一個頁面,js、css代碼都寫在html頁面中。 例如:gnj.html v1版本Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-...
閱讀全文
一、列與行的參數都由三個部分組成:對齊方式、固定尺寸、調整方式。
1.對齊方式:
1)列對齊有left, center, right, fill.默認fill
2)行對齊有:top, center, bottom, fill. 其中fill表示填充至整個區域。默認center。
2.固定尺寸:
pref表示preferred size,適當大小,即首選尺寸大小。
min表示minimum size,
dlu 表示dialog units,
px, pt, in, mm, cm)分別表示Pixel, Points, Inches, Millimeter, Centimeter。
3. 調整方式:
二、CellConstraints:
cc.xywh(3, 1, 3, 1):表示3列,1行,colspan=3,rowspan=1
三、FormLayout:
1.FormLayout layout = new FormLayout(
new ColumnSpec[]{
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC,
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC,
FormSpecs.DEFAULT_COLSPEC,
FormSpecs.GLUE_COLSPEC},
new RowSpec[]{
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.GLUE_ROWSPEC
}
);
2.
FormLayout layout = new FormLayout(
"right:pref, 6dlu, 50dlu, 4dlu, center:50dlu", // columns
"pref, 3dlu, pref, 3dlu, pref"); // rows
參考文章:
http://hi.baidu.com/lijunwyf/item/a18d95f719ff01da6225d26f
例子:
import java.util.*;
public class TestVector{
public static void main(String[] args){
Vector v = new Vector();
v.add(null);
v.add(new Integer(1));
v.add("123");
for(Enumeration e = v.elements();e.hasMoreElements();){
System.out.println(e.nextElement());
}
v.insertElementAt("insert",2);
v.setElementAt("insert",0);
for(Enumeration e = v.elements();e.hasMoreElements();){
System.out.println(e.nextElement());
}
}
}
結果:
null
1
123
insert
1
insert
123
結論:
vector中可以放入null;
vector可以放入不同類型的對象;
vector是同步的容量自增長的向量;
一、前提須知:
1.北京鐵路局:
直屬站15個:
北京站、
北京西站、
天津站、
天津西站、
豐臺站、
豐臺西站、
南倉站、
塘沽站、
唐山站、
石家莊站、
石家莊南站、邯鄲站、
陽泉站、北京南站、天津西站。
2.鄭州鐵路局:
直屬車站11個:
鄭州站、鄭州北站、鄭州東站、洛陽站、
新鄉站、開封站、商丘站、
月山站、長治北站、長治站。
二、
北京電話訂票竅門:1、座機打!;2.用手機加區號打!北京鐵路局管內,如唐山區號:打0315-95105105,手機打95105105的有效區號:河北省邯鄲0310石家莊0311保定0312張家口0313承德0314唐山0315廊坊0316滄州0317衡水0318邢臺0319秦皇島0335山東德州0534山西陽泉0353天津022。訂好之后可以在北京取票!!
ERROR - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
om update [0]; actual row count: 0; expected: 1
ERROR - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
現象:
頁面報500.
原因:
在request.getRequestDispatcher("/success.html").forward(request, response);
后面還有未執行的代碼,但是已經提交了響應。
1.UML:unified modeling Language(統一建模語言)
2.草圖與藍圖:
前者指:手工繪制的、規范度較低的UML模型;
后者指:case工具繪制的正式的、規范的UML模型;
3.不同可視性的符號:
“+”:public “#”:protected “-”:private “~”:package
4.UML主要包含三種圖:靜態圖、動態圖、物理圖
5.關聯關系:用來表示一個對象持有另外一個對象的引用,或是調用另外一個對象的方法
6.類圖:

7.類圖之間的關聯:
—▷▷ —>持有
1.public class TestKnowleage5 {
public static void main(String[] args){
String strValue = "ABCDEFG";
strValue.substring(3);
System.out.println("result1"+strValue);
strValue.concat("123");
System.out.println("result2"+strValue);
String value = new String("ABCDEFG");
System.out.println(strValue==value);
}
}
運行結果:
result1ABCDEFG
result2ABCDEFG
false
2.public class Test{
public static void main(String[] args){
int x = 100;
int y = 200;
if(x == y)
System.out.println("not equal");
else
System.out.println("equal");
}
}
運行結果:
equal
3.public class TestKnowleage5 {
public static void main(String[] args){
try{
new TestKnowleage5().methodA(5);
}catch(IOException e){
System.out.println("caught IOException");
}catch(Exception e){
System.out.println("caught Exception");
}finally{
System.out.println("no Exception");
}
}
public void methodA(int i) throws IOException{
if(i%2 != 0){
throw new IOException("methodA IOException");
}
}
}
運行結果:
caught IOException
no Exception
4.public class TestKnowleage5 {
static boolean isTrue(){
System.out.println("isTrue");
return true;
}
static boolean isFalse(){
System.out.println("isFalse");
return false;
}
public static void main(String[] args){
if(isTrue() || isFalse()){
System.out.println("|| operate return true");
}
if(isFalse() & isTrue()){
System.out.println("& operate return true");
}
}
}
運行結果:
isTrue
|| operate return true
isFalse
isTrue
5.public class TestKnowleage5{
public static void main(String args[]){
MyThread t = new MyThread();
t.run();
t.start();
System.out.println("A");
}
}
class MyThread extends Thread{
public void run(){
try{
Thread.currentThread().sleep(3000);
}catch(InterruptedException e){
}
System.out.println("B");
}
}
運行結果:
BBA或
BAB
6.class A{
void fun1(){
System.out.println(fun2());
}
int fun2(){
return 123;
}
}
public class TestKnowleage5 extends A{
int fun2(){
return 456;
}
public static void main(String[] args){
A a;
TestKnowleage5 b = new TestKnowleage5();
b.fun1();
a = b;
a.fun1();
}
}
運行結果:
7.class A{
int val;
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
public class TestKnowleage5{
public static void main(String[] args){
A data = new A();
ArrayList list = new ArrayList();
for(int i=100;i<103;i++){
data.setVal(i);
list.add(data);
}
int j = 0;
while(j<list.size()){
A tmp = (A)list.get(j);
System.out.println("list("+j+")="+tmp.getVal());
j++;
}
}
}
運行結果:
list(0)=102
list(1)=102
list(2)=102
8.hibernate導入大量數據時,為了避免內存中產生大量對象,在編碼時注意什么,如何去除?
9.視圖與表的區別
10.觸發器有哪幾種類型
11.
事務操作有那幾個步驟
12.寫出對應正則表達式:
1)1-6位字母或數字;
[a-zA-Z0-9]{1,6}
2)手機號(只能是139或159開頭,11位數字)
1[35][9][0-9]{8}
13.字符串反轉:new StringBuilder(str).reverse().toString();
14.寫程序:1+2²+3²+...+n²
int func(int n){
return n==1?1:func(n-1)+n*n
}
15.寫一個延遲加載的單例模式:
public class SingleTon{
private static SingleTon instance = null;
private SingleTon(){}
public static SingleTon getInstance(){
if(instance == null){
synchronized(""){
if(instance == null){return new SingleTon();}
}
}
return instance;
}
}
16.
JSP的9種內置對象:request:
HttpServletRequest類的實例,客戶端的請求信息被封裝在request對象中response:
HttpServletResponse類的實例,response對象包含了響應客戶請求的有關信息,但在JSP中很少直接用到它。out:
out對象是JspWriter類的實例,是向客戶端輸出內容常用的對象session:
session對象指的是客戶端與服務器的一次會話,從客戶端連到服務器的一個WebApplication開始,直到客戶端與服務器斷開連接為止。它是HttpSession類的實例page:
page對象就是指向當前JSP頁面本身,有點象類中的this指針,它是java.lang.Object類的實例application:
ServletContext類的實例,application對象實現了用戶間數據的共享,可存放全局變量。它開始于服務器的啟動,直到服務器的關閉exception:
exception對象是一個例外對象,當一個頁面在運行過程中發生了例外,就產生這個對象。如果一個JSP頁面要應用此對象,就必須把isErrorPage設為true,否則無法編譯。他實際上是java.lang.Throwable的對象pageContext:
pageContext對象提供了對JSP頁面內所有的對象及名字空間的訪問,也就是說他可以訪問到本頁所在的SESSION,也可以取本頁面所在的application的某一屬性值,他相當于頁面中所有功能的集大成者,它的本類名也叫pageContextconfig:
config對象是在一個Servlet初始化時,JSP引擎向它傳遞信息用的,此信息包括Servlet初始化時所要用到的參數(通過屬性名和屬性值構成)以及服務器的有關信息(通過傳遞一個ServletContext對象)17.session和cookie的區別?
18.JDBC的操作步驟?
1.方法重載與多態,簡述;
2.什么是設計模式?使用過哪些?
3.列出熟悉的java開源項目及簡述;
4.一組radio,用alert彈出當前所選的是第幾個radio?用原生javascript;
5.function showme(){
Book.prototype.abc = function(){
alert('456');
}
var abook = new Book(1,2);
Book.abc = function(){
alert('123');
}
abook.abc();
Book.abc();
abc();//此方法調用瀏覽器會報錯,未定義
}
function Book(a,b){
this.a = a;
this.b = b;
Book.abc = function(){
alert('def');
}
this.abc = function(){
alert('xyz');
}
abc = function(){
alert('@@@@@@');
}
var abc = function(){
alert('$$$$$$');
}
}
點擊按鈕調用showme(),頁面顯示結果為:
第一個彈出框:xyz
第二個彈出框:123
6.線程的四種狀態?
7.ext有哪些組件?ext如何與后臺交互?
8.HashMap放入、查找、刪除,將所有value放入一個數組,得到map中所有內容;List添加、查找、刪除;
9.List<Student> student(name,age) 比較oldList<Student>和newList<student>,按名字比較,獲得新增的、修改的、刪除學生列表;
10.使用過哪些xml技術?怎么實現的?
11.java異常:throws、throw、try、catch、finally,舉例,如何處理異常
12.字符串反轉:
public class TestKnowleage5 {
public static void main(String[] args){
System.out.println(reverse("abc"));
System.out.println(reverse2("abc"));
System.out.println(reverse3("abc"));
}
public static String reverse(String str){
return new StringBuffer(str).reverse().toString();
}
public static String reverse2(String str){
char[] chs = str.toCharArray();
char[] re = new char[chs.length];
for(int i = 0 ; i<chs.length;i++){
re[i] = chs[chs.length - i - 1];
}
return new String(re);
}
public static String reverse3(String str){
char[] chs = str.toCharArray();
String re = "";
for(int i = 0;i<chs.length;i++){
re += chs[chs.length - 1 -i];
}
return re;
}
}
//此句,編譯無法通過,Cannot make a static reference to the non-static field b
1.arrayList、linkedList、vector的區別
2.寫幾種J2EE規范并簡要描述
3.什么是設計模式?用過哪些設計模式?
4.OO的四大特性是哪些?并簡要描述
5.方法重載、多態概念及簡要描述;
6.sql常用的優化方法有哪些?
7.sleep()與wait()的區別?
8.
public class TestException {
public static void main(String[] args) {
int i = 1;
switch(i){
case 0:
System.out.println(0);
break;
case 1:
System.out.println(1);
default:
System.out.println(4);
case 2:
System.out.println(2);
case 3:
System.out.println(3);
}
}
}
運行結果:
1
4
2
3
9.HashTable和HashMap的區別
10.怎樣理解mvc模式?
11.抽象類、接口的區別?
12.智力題:
有1-7號,7塊地,S、U、V、W、X 5個遺產繼承者,
S若繼承2號,不能繼承3號;
3號和4號不能同時繼承;
S若繼承一塊或多塊地,則U不能繼承
1塊地不能被2人合分;
問:若S繼承2號地,剩余3個人中,不能同時哪2塊地?
A:1和6 B:1和7 c:3和7 d:1和5 e:1和3
13.
public class TestKnowleage5 {
static int a;
int b,c=0;
public static void main(String[] args){
a++;
b++;//此句,編譯無法通過,Cannot make a static reference to the non-static field b
c++; //此句,編譯無法通過,cannot make a static reference to the non-static field c
參考文章:
1,有三個jsp頁面:a.jsp b.jsp c.jsp,流程是a.jsp--> b.jsp--> c.jsp,其中a.jsp提交的數據要在c.jsp中訪問,用最簡單的辦法怎么做?不用session。
在b.jsp中放N個hidden隱藏域保存a.jsp中的數據,一起提交到c.jsp,在c.jsp中取出。2.sql server支持集群么?
支持,不過屬于熱備份類型,不能做負載均衡。不過符合你的條件
首先系統做集群,數據庫文件放到磁盤陣列里,雙機或多機共同訪問磁盤陣列,就可以了,可以集群后做負載均衡;
3.HashTable與HashMap的區別:
1)HashMap非線程安全,HashTable線程安全;
2)HashMap可放一條key為空的記錄,任意記錄的value可為空,hashTable不可以;
3)hashMap去掉了contains方法,增加了containsKey和containsValue方法;
4.如何理解mvc模式:
mvc是sun提出的model2開發模式,將控制、視圖、模型進行了分離;提高了可維護性、擴展性、可移植性、組件的可復用性;
5.SingleTon:
6.對象序列化的含義:
java序列化技術可以使你將一個對象的狀態寫入一個byte流里,并且可以從其它地方把該byte流里的數據讀出來,重新構造一個相同的對象。
這種機制允許你將對象通過網絡傳播,并且隨時可以把對象持久化到數據庫、文件等系統里,java的序列化技術是RMI、EJB等技術的基礎;
實現方法:implements Serializable標記為可序列化,然后用ObjectOutputStream和ObjectInputStream讀寫;
7.數據庫中的鎖包含哪些?
排它鎖和共享鎖
8.jsp和servlet的區別:
1)簡單來說:jsp就是含有java代碼的html,servlet就是含有html的java代碼;
2)jsp最終被解釋成servlet,編譯再執行,jsp不過是servlet的另一種編寫形式;
3)jsp擅長表示,servlet擅長數據處理,在mvc中jsp處于視圖層,servlet處于控制層;
9.oracle在數據庫中的交集怎么表示:
1)用intersect操作符 2)用in 語句
9.JNDI、JMS、JTA、RMI:
JNDI:java naming and directory interface java命名目錄接口
JMS:java messing service java消息服務
JTA:java transaction api java事務api
RMI:
Remote Method Invocation 遠程方法調用
10.事務:
1)ACID屬性:
A:atomic 原子性
C:consistent 一致性
I:isolation 隔離性
D:duration 持久性
2)概念:事務就是一系列操作,它們完成一項任務。只要這些操作里有一項沒成功,事務就操作失敗,發生回滾事件。即撤銷前面的操作,這樣可以保證數據的一致性。而且可以把操作放在緩存里,等所有操作都成功就提交數據庫,這樣保證費時的操作都是有效操作。
3)隔離級別 4)傳播行為
參考文檔:
http://wenku.baidu.com/view/56a532eb856a561252d36f81.html
1.String b = new String("1"+"2"); -->4個
2.Customer(id,name,phone,country);每個客戶均有地區(country)屬性,每個地區可有1或多個客戶,查詢擁有超過10名客戶的地區的列表;
3.public interface TreeNode{
String getName();
List getChildren();
}
寫一個print()方法,打印各級節點名稱.
4.String與StringBuffer的區別?
String
5.ajax名詞解釋,它的核心價值及原理;
6.事務的概念及名詞解釋;
7.數據庫表之間有幾種關系,并舉例;
8.Filter的原理,常見用例;
9.視圖與表的區別?觸發器類型有哪些類型?
10.建表及各種約束;
11.hibernate導入大量數據時,為了避免內存中產生大量對象,在編碼時注意什么,如何去除?