我個人認為真正的程序開發人員應該是大部分都用快捷鍵的。以前,很多次java課后我們去問老師問題時,他總是"啪啪啪"地代碼一會跳這一會跳那,看得我們眼花繚亂。當時,我就羨慕死了,心想:以后我也要這樣!
現在,雖然我還沒有到他那樣的水平,但是我還是盡量會用快捷鍵。
下面就用到一些常到的快捷鍵:
ctrl+a:全選
ctrl+c:復制
ctrl+v:粘貼
我常用的還有shift/Home/End+上下左右鍵
大家有哪些常用的快捷鍵啊,說出來大家分享分享
對于對Myeclipse不熟悉卻還要用它來開發spring的初學者來說,是比較有困難的,因為我就是這樣過來的。所以,我做了個flash演示項目的 步驟,但是太大了,上傳不了。對于我這個剛注冊blogjava的新手來說,有些功能還不太清楚。現在我先把步驟寫下來,等以后我有時間把 blogjava弄明白了,看能不能再把那個flash上傳上來。
步驟:
第一步:建工程
File -> New -> Project ->Web Project,"Project
Name":MySpringTest,然后"Finish";
第二步:導入spring包
選中MySpringTest,右擊,MyEclipse
-> Add Spring Capabilities……,都默認即可;
第三步:
建立項目所需類;MySpringTest -> src -> New
...(以下三個都這樣建)
Spring 的開發沒法自動生成 Bean, 這里大家只好手工來寫了, 也很簡單。
1、接口Action:(MySpringTest ->
src -> New -> interface ,取名為Action)
public String execute(String str);
}
2、實現接口Action的類UpperAction:(將其 message 屬性與輸入字符串相連接,并返回其大寫形式。)
2 public class UpperAction implements Action{
3 private String message;
4
5 public String getMessage() {
6 return message;
7 }
8
9 public void setMessage(String message) {
10 this.message = message;
11 }
12 public String execute(String str){
13 return (getMessage()+str).toUpperCase();
14 }
15 }
16
3、實現接口Action的類LowerAction:
(將其 message 屬性與輸入字符串相連接,并返回其小寫形式。)(MySpringTest -> src -> New -> class ,取名為LowerAction)
2 public class LowerAction implements Action{
3 private String message;
4
5 public String getMessage() {
6 return message;
7 }
8 public void setMessage(String message) {
9 this.message = message;
10 }
11 public String execute(String str){
12 return(getMessage()+str).toLowerCase();
13 }
14 }
15
4、做測試用的SimpleTest類:
(MySpringTest -> src -> New -> class ,取名為SimpleTest)
2 import org.springframework.context.support.FileSystemXmlApplicationContext;
3
4 public class SimpleTest {
5 public static void main(String args[])
6 {
7 SimpleTest test=new SimpleTest();
8 test.testQuickStart();
9 }
10 public void testQuickStart(){
11 ApplicationContext ctx=new FileSystemXmlApplicationContext("src/bean.xml");
12 Action action=(Action)ctx.getBean("action1");
13 System.out.println(action.execute("Rod Johnson"));
14 action=(Action)ctx.getBean("action2");
15 System.out.println(action.execute("jeckj"));
16 }
17 }
18
第四步:配置applicationContext.xml文件
2 <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
3 <beans>
4 <description>Spring Quick Start</description>
5
6 <!--該處bean中的name值必須是 其對應的class中的私有成員名
7 -->
8 <bean id="action1" class="UpperAction">
9 <property name="message">
10 <value>HeLLo</value>
11 </property>
12 </bean>
13
14 <bean id="action2" class="LowerAction">
15 <property name="message">
16 <value>HeLLo</value>
17 </property>
18 </bean>
19
20 </beans>
第四步:調試
雙擊 Package Explorer 下 MySpringTest/src/TestAction.java 打開源代碼,點擊菜單 Run -> Run As -> 1. Java Application, 如果沒有錯誤的話將會出現如下
2 log4j:WARN Please initialize the log4j system properly.
3 HELLOROD JOHNSON
4 hellojeckj
問題:
1 log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
2 log4j:WARN Please initialize the log4j system properly.
1、我也是個初學者,我想請問比較上手的人士,上面兩行是什么意思?
2、這個例子中沒有用到Tomcat,是不是spring框架不需Web Service,還只是不用Tomcat?