Spring和Struts框架學(xué)習(xí)總結(jié)_第1頁
Spring和Struts框架學(xué)習(xí)總結(jié)_第2頁
Spring和Struts框架學(xué)習(xí)總結(jié)_第3頁
Spring和Struts框架學(xué)習(xí)總結(jié)_第4頁
Spring和Struts框架學(xué)習(xí)總結(jié)_第5頁
已閱讀5頁,還剩129頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、認(rèn)識(shí)負(fù)數(shù)說課稿DOCTYPE HTML尊敬的評(píng)委老師,大家好!PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN">下面我將從教材、教學(xué)目標(biāo)、教學(xué)重難點(diǎn)、教法與學(xué)法、教具與學(xué)具、教學(xué)過程等方面來進(jìn)行我的說課。<html><head>一、說教材在學(xué)習(xí)負(fù)數(shù)之前,學(xué)生已經(jīng)深刻認(rèn)識(shí)了自然數(shù)、分?jǐn)?shù)和小數(shù),負(fù)數(shù),對(duì)于小學(xué)生來說是數(shù)概念的一次拓展,有利于中小學(xué)數(shù)學(xué)的銜接。通過今天這節(jié)課的學(xué)習(xí),有助于他們理解生活中遇到的負(fù)數(shù),拓展數(shù)學(xué)視野。href二、說教學(xué)目標(biāo)"<%=知識(shí)與技能:理解負(fù)數(shù)的意義,會(huì)用正、負(fù)數(shù)

2、表示日常生活中具有相反意義的量;會(huì)正確讀、寫正數(shù)與負(fù)數(shù);知道%>既不是正數(shù),也不是負(fù)數(shù)。>過程與方法:通過讓學(xué)生自主探索負(fù)數(shù)的意義,培養(yǎng)學(xué)生獨(dú)自解決問題的能力。 情感態(tài)度與價(jià)值觀:通過本節(jié)課的教學(xué),使學(xué)生獲得成功的體驗(yàn),建立自信心,激發(fā)學(xué)生對(duì)數(shù)學(xué)的興趣。 <三、說教學(xué)重點(diǎn)與難點(diǎn)>教學(xué)重點(diǎn):會(huì)用正、負(fù)數(shù)表示日常生活中具有相反意義的量;會(huì)正確讀、寫正數(shù)與負(fù)數(shù)。教學(xué)難點(diǎn):正確理解正數(shù)、負(fù)數(shù)、>既不是正數(shù)也不是負(fù)數(shù)。四、說教法、學(xué)法head>合作交流”的學(xué)習(xí)方式。<五、說教具與學(xué)具><六、說教學(xué)過程 action=、我是小小記錄員method=&g

3、t;2000用戶名元;<甲隊(duì)上半場(chǎng)進(jìn)了2個(gè)球,下半場(chǎng)丟了1個(gè)球。通過以上活動(dòng)的設(shè)計(jì),以游戲的方式讓學(xué)生初步感受到兩個(gè)想反意義的量的產(chǎn)生是由于實(shí)際生活所需,接下來我將學(xué)生記錄信息的方法展示出來,然后,我順勢(shì)向?qū)W生介紹,什么是相反意義的量,同時(shí)通過多媒體展示一段天氣預(yù)報(bào),讓學(xué)生交流零上和零下表達(dá)了什么意思?密碼 <input叫做做負(fù)數(shù)。name"userPassWord"type="password"><br>2、動(dòng)手操作<input(1=submit (2 value="提交3、利用多媒體向?qū)W生展示了一個(gè)溫度計(jì)

4、,并提出以下三個(gè)問題:> 這里有兩排刻度,應(yīng)該讀哪一排呢? <每一小格分別代表多少攝氏度?type=reset value="取消學(xué)生小組內(nèi)合作交流來解決,教師巡視,及時(shí)指導(dǎo)。> 結(jié)合教材的教學(xué)情境,我讓學(xué)生通過觀察溫度計(jì)讀出室內(nèi)的溫度是零上form表示;同樣讀出室外的溫度是零下16body0是分界點(diǎn)。那么,0是正數(shù)還是負(fù)數(shù)呢?>最后修改web.xml的配置文件,0既不是正數(shù),也不是負(fù)數(shù)的教學(xué)難點(diǎn)。xmlversion學(xué)生自主完成教材習(xí)題,教材按照從易到難的順序設(shè)置習(xí)題,讓學(xué)生獨(dú)立="1.0" encoding="UTF-8&qu

5、ot;?><web-app version="2.5" xmlns= xmlns:xsi= xsi:schemaLocation=<display-name> display-name> <welcome-file-list><welcome-file>index.jsp welcome-file>welcome-file-list><filter><filter-name>struts2 filter-name>filter><filter-mapping>&

6、lt;filter-name>struts2 filter-name><url-pattern>/* url-pattern>filter-mapping>web-app>9.部署項(xiàng)目到tomcat下,在瀏覽器中顯示如下:用戶名和密碼輸入正確用戶名或密碼輸入不正確1、 Action中訪問web對(duì)象1. java代碼如下:packageimport ;importimport/創(chuàng)建一個(gè)UserAction繼承ActionSupport類;public class UserAction extends ActionSupportprivate String

7、 userName;private String userPassWord;public String getUserName( return userName;public void setUserName(String userName this.userName = userName;public String getUserPassWord( return userPassWord;public void setUserPassWord(String userPassWord this.userPassWord = userPassWord;Overridepublic String

8、execute( throws Exception if("Mike".equals(userName&&"123".equals(userPassWord|"張三".equals(userName&&"123".equals(userPassWord/用戶名保存到session中;ActionContext.getContext(.getSession(.put("userName",userName; /保存信息在request;ActionContext.g

9、etContext(.put("msg","歡迎"+userName+"訪問本網(wǎng)站"return "success"elsereturn "error" 2. struts.xml代碼如下:xml version="1.0" encoding="UTF-8"?>DOCTYPE struts PUBLIC"-Apache Software Foundation/DTD Struts Configuration 2.0/EN">

10、<struts><package name="actions" extends="struts-default"><action name="login" class=><result name="success">/success.jsp result><result name="error">/error.jsp result> action>package>struts>3. index.jsp代碼如

11、下:<% page language="java" import= pageEncoding="utf-8"%><%String path = request.getContextPath(;String basePath = request.getScheme(+":/"+request.getServerName(+":"+request.getServerPort(+path+"/"%>DOCTYPE HTML PUBLIC "-/W3C/DTD HTML

12、 4.01 Transitional/EN"><html><head><base href="<%=basePath%>"><title>My JSP 'index.jsp' starting page title>head><body><form action="login.action" method="post">用戶名 <input name="userName" type=

13、"text"><br>密碼 <input name="userPassWord" type="password"><br><input type=submit name=subm value="提交"> <input type=reset name=reset value="取消"> form>body>html>4. success.jsp代碼如下:<% page language="java&

14、quot; contentType="text/html; charset=utf-8"pageEncoding="utf-8"%><%String path=request.getContextPath(;String basePath=request.getScheme(+":/"+request.getServerName(+":"+request.getServerPort(;%> DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transiti

15、onal/EN" ><html><head><base href="<%=basePath%>"><title>my success jsp page title>head><body><%-歡迎<%=request.getParameter("userName" %>登錄-%><h1>$requestScope.msgh1><h2>$sessionScope.userNameh2>body>

16、;html>5. error.jsp代碼如下:<% page language="java" contentType="text/html; charset=utf-8"pageEncoding="utf-8"%><%String path=request.getContextPath(;String basePath=request.getScheme(+":/"+request.getServerName(+":"+request.getServerPort(+pat

17、h+"/"%>DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" ><html><head><base href="<%=basePath%>"><title>my error jsp page title>head><body><h1>用戶名或密碼錯(cuò)誤h1>body>html>6. 程序運(yùn)行如下:2、 我的第一個(gè)spring程序3.1新建一個(gè)de

18、mo1實(shí)體類,代碼如下:/新建一個(gè)學(xué)生實(shí)體類;public class Demo1 public Demo1(System.out.println("我的第一個(gè)spring程序"3.2新建一個(gè)TestDemo1測(cè)試類代碼如下:public class TestDemo1 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("demo1.xml"Demo1 demo1=(Demo1 cx.getBea

19、n("Demo1"xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo1" class=>bean>beans>1. 程序運(yùn)行如下:4.init和destory方法package/新建一個(gè)Demo2的實(shí)體類;public class Demo2 public void init(System.out.println("這是init方

20、法"public void destory(System.out.println("調(diào)用cx.close方法之后"System.out.println("這是destory方法"4.2新建一個(gè)TestDemo2的測(cè)試類packageimportpublic class TestDemo2 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("demo2.xml"Demo

21、2 demo2=(Demo2 cx.getBean("Demo2"/只有當(dāng)執(zhí)行cx.close方法時(shí),Demo2中的destory方法才會(huì)被執(zhí)行;cx.close(;4.3 新建一個(gè)demo2.xml的配置文件xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo2" class= init-method="init" destroy-met

22、hod="destory">bean>beans>4.4程序運(yùn)行如下:5、 spring中實(shí)體類值的設(shè)定5.1 編寫一個(gè)Demo3的實(shí)體類;packagepublic class Demo3 private int id;private String name;private String pwd;public int getId( return id;public void setId(int id this.id = id;public String getName( return name;public void setName(String nam

23、e = name;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;public Demo3(System.out.println("這是Demo3的構(gòu)造方法" public void testDemo3(System.out.println("Demo3 id=" + id + ", name=" + name + ", pwd=" + pwd + ""5.2編寫一個(gè)T

24、estDemo3測(cè)試類;packageimportpublic class TestDemo3 public static void main(String args ClassPathXmlApplicationContext cx = new ClassPathXmlApplicationContext("demo3.xml"Demo3 demo3 = (Demo3 cx.getBean("Demo3"demo3.testDemo3(;5.3 編寫一個(gè)demo3.xml的配置文件xml version="1.0" encoding

25、="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo3" class= scope="prototype"><property name="id" value="001"/><property name="name" value="tom"/><property name="pwd" value=

26、"123456"/>bean>beans>5.4程序運(yùn)行如下:6、 set注入和構(gòu)造方法注入6.1編寫一個(gè)Demo3的實(shí)體類;packagepublic class Demo3 private int id;private String name;private String pwd;public int getId( return id;public void setId(int id this.id = id;public String getName( return name;public void setName(String name this.

27、name = name;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;public Demo3(System.out.println("無參的構(gòu)造方法"public Demo3(int id,String name,String pwdSystem.out.println("構(gòu)造方法注入"System.out.println("Demo3 id=" + id + ", name=" + name + &qu

28、ot;, pwd=" + pwd + "" public void testDemo3(System.out.println("set方法注入"System.out.println("Demo3 id=" + id + ", name=" + name + ", pwd=" + pwd + ""6.2編寫一個(gè)TestDemo3的測(cè)試類;packageimportpublic class TestDemo3 public static void main(String

29、 args ClassPathXmlApplicationContext cx = new ClassPathXmlApplicationContext("demo3.xml"Demo3 demo3 = (Demo3 cx.getBean("Demo3"demo3.testDemo3(;6.3編寫一個(gè)demo3.xml配置文件xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean

30、 id="Demo3" class=><property name="id" value="001"/><property name="name" value="tom"/><property name="pwd" value="123456"/><constructor-arg name="id" value="002" index="0"/>

31、;<constructor-arg name="name" value="link" index="1"/><constructor-arg name="pwd" value="123456" index="2"/>bean>beans>6.4 程序運(yùn)行如下:7、 引入其他類值的獲得7.1新建一Demo3實(shí)體類;packagepublic class Demo3 private int id;private String name;priv

32、ate String pwd;private Cart cart;public int getId( return id;public Cart getCart( return cart;public void setCart(Cart cart this.cart = cart;public void setId(int id this.id = id;public String getName( return name;public void setName(String name = name;public String getPwd( return pwd;publ

33、ic void setPwd(String pwd this.pwd = pwd;public Demo3(System.out.println("無參的構(gòu)造方法"/測(cè)試構(gòu)造方法的注入; public Demo3(int id,String name,String pwd, Cart cartSystem.out.println("構(gòu)造方法注入"System.out.println("Demo3 id=" + id + ", name=" + name + ", pwd=" + pwd + &q

34、uot;" System.out.println("card屬性的獲得"System.out.println("id="+cart.getId(;/測(cè)試set方法的注入;public void testDemo3(System.out.println("set方法注入"System.out.println("Demo3 id=" + id + ", name=" + name + ", pwd=" + pwd + ""7.2 新建一個(gè)TestDe

35、mo3測(cè)試類;packageimportpublic class TestDemo3 public static void main(String args ClassPathXmlApplicationContext cx = new ClassPathXmlApplicationContext("demo3.xml"Demo3 demo3 = (Demo3 cx.getBean("Demo3"demo3.testDemo3(;7.3 新建一個(gè)外來類Cartpackagepublic class Cart private int id;public v

36、oid setId(int idthis.id=id;public int getId(return id;7.4 新建一個(gè)demo3.xml配置文件xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo3" class= scope="prototype"><property name="id" value="001&

37、quot;/><property name="name" value="tom"/><property name="pwd" value="123456"/><constructor-arg name="id" value="002" index="0"/><constructor-arg name="name" value="link" index="1&q

38、uot;/><constructor-arg name="pwd" value="123456" index="2"/><constructor-arg ref="cart"/>bean><bean id="cart" class=><property name="id" value="654321"/>bean> beans>7.5程序運(yùn)行如下:8.測(cè)試三種獲得對(duì)象方法8.1新建一個(gè)

39、Demo實(shí)體類;packagepublic class Demo4 public Demo4(System.out.println("測(cè)試三種獲得對(duì)象方式"8.2新建一個(gè)TestDemo測(cè)試類;packageimportpublic class TestDemo4 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("demo4.xml"Demo4 demo41=(Demo4 cx.getBean(

40、"Demo4"Demo4 demo42=(Demo4 cx.getBean(Demo4.class;Demo4 demo43=(Demo4 cx.getBean("Demo4",Demo4.class;System.out.println(demo41;System.out.println(demo42;System.out.println(demo43; xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocat

41、ion=><bean id="Demo4" class=> bean>beans>8.4程序運(yùn)行如下:9、構(gòu)造方法數(shù)據(jù)類型的測(cè)試9.1 新建一個(gè)Demo1的實(shí)體類package/新建一個(gè)Demo1的實(shí)體類;public class Demo1 private int id;private String name;private String pwd;public Demo1( public int getId( return id;public void setId(int id this.id = id;public String getNa

42、me( return name;public void setName(String name = name;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;Overridepublic String toString( return "Demo1 id=" + id + ", name=" + name + ", pwd=" + pwd + ""public Demo1(int id,

43、String name, String pwd super(;this.id = id; = name;this.pwd = pwd;9.2 新建一個(gè)TestDemo1的測(cè)試類packageimportpublic class TestDemo1 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("entity2Xml/demo1.xml"Demo1 demo1=(Demo1 cx.getBean(

44、"Demo1"System.out.println("構(gòu)造方法類型的測(cè)試"System.out.println(demo1;xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo1" class=><constructor-arg name="id" value="001" index=&q

45、uot;0" type="int"/><constructor-arg name="name" value="tom" index="1" type="String"/><constructor-arg name="pwd" value="123456" index="2" type="String"/>bean>beans>9.4程序運(yùn)行如下:10、特殊字符的處理

46、101新建一個(gè)Demo2的實(shí)體類;package/新建一個(gè)Demo2的實(shí)體類;public class Demo2 private int id;private String name;private String pwd;public Demo2( public int getId( return id;public void setId(int id this.id = id;public String getName( return name;public void setName(String name = name;public String getPwd( re

47、turn pwd;public void setPwd(String pwd this.pwd = pwd;Overridepublic String toString( return "Demo1 id=" + id + ", name=" + name + ", pwd=" + pwd + ""public Demo2(int id, String name, String pwd super(;this.id = id; = name;this.pwd = pwd;10.2新建一個(gè)TestD

48、emo1的測(cè)試類;packageimportpublic class TestDemo2 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("entity2Xml/demo2.xml"Demo2 demo2=(Demo2 cx.getBean("Demo2"System.out.println("特殊字符的處理"System.out.println(demo2;10.3 新建一

49、個(gè)demo2.xml的配置文件xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xsi:schemaLocation=><bean id="Demo2" class=><property name="id"><value></span><span style="font-family:Consolas;font-weight:700;color:#7F0055;fon

50、t-size:18.666666666667px;">001</span><span style="font-family:Consolas;color:#3F7F5F;font-size:18.666666666667px;"> value>property> <property name="name"><value></span><span style="font-family:Consolas;font-weight:700;color:#7F0

51、055;font-size:18.666666666667px;">link</span><span style="font-family:Consolas;color:#3F7F5F;font-size:18.666666666667px;"> value>property> <property name="pwd"><value></span><span style="font-family:Consolas;font-weight:700;col

52、or:#7F0055;font-size:18.666666666667px;">123456</span><span style="font-family:Consolas;color:#3F7F5F;font-size:18.666666666667px;"> value>property> bean>beans>10.4程序運(yùn)行如下:11.外來類的注入11.1新建一外來類User的實(shí)體類;packagepublic class User3 private int id;private String nam

53、e;private String pwd;public int getId( return id;public void setId(int id this.id = id;public String getName( return name;public void setName(String name = name;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;Overridepublic String toString( return "User3

54、id=" + id + ", name=" + name + ", pwd=" + pwd + ""public User3(int id, String name, String pwd super(;this.id = id; = name;this.pwd = pwd;public User3( super(;/ TODO Auto-generated constructor stub11.2新建一個(gè)Demo3的實(shí)體類;packagepublic class Demo3 private int id;

55、private String name;private String pwd;private User3 user3;public int getId( return id;public void setId(int id this.id = id;public String getName( return name;public void setName(String name = name;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;public User3

56、getUser3( return user3;public void setUser3(User3 user3 this.user3 = user3;Overridepublic String toString( return "Demo3 id=" + id + ", name=" + name + ", pwd=" + pwd + "n"+ user3 + ""public Demo3(int id, String name, String pwd, User3 user3 super(;t

57、his.id = id; = name;this.pwd = pwd;this.user3 = user3;public Demo3( super(;/ TODO Auto-generated constructor stub11.3新建一個(gè)TestDemo3的測(cè)試類;packageimportpublic class TestDemo3 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("entity2Xm

58、l/demo3.xml"Demo3 demo3=(Demo3 cx.getBean("demo3"System.out.println(demo3;11.4 新建一個(gè)demo3.xml的配置文件;xml version="1.0" encoding="UTF-8"?><beans xmlns= xmlns:xsi=xmlns:p= xsi:schemaLocation=" ><bean id="user3" class= p:id="002" p:na

59、me="tom" p:pwd="123456"> bean><bean id="demo3" class= p:id="001" p:name="link" p:pwd="123456" autowire=" byType" depends-on="user3"/> beans>11.5 程序運(yùn)行如下: 12 讀取oracle的連接信息12.1 新建一個(gè)數(shù)據(jù)庫實(shí)體類Demo1/jdbcpublic clas

60、s Demo1 private static String url;private static String user;private static String pwd;private static String driverClass;public Demo1(public static Connection getConn(Connection conn=null;try conn=DriverManager.getConnection(url,user,pwd; catch (Exception e / TODO: handle exceptionreturn conn;public

61、 String getUrl( return url;public void setUrl(String url this.url = url;public String getUser( return user;public void setUser(String user this.user = user;public String getPwd( return pwd;public void setPwd(String pwd this.pwd = pwd;public String getDriverClass( return driverClass;public void setDr

62、iverClass(String driverClass try Class.forName(driverClass; catch (ClassNotFoundException e / TODO Auto-generated catch blocke.printStackTrace(;this.driverClass = driverClass;Overridepublic String toString( return ""public Demo1(String url, String user, String pwd, String driverClass super

63、(;this.url = url;this.user = user;this.pwd = pwd;this.driverClass = driverClass; 12.2 新建一個(gè)TestDemo1測(cè)試類;packageimportpublic class TestDemo1 public static void main(String args ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("util/demo1.xml"Demo1 demo1=(Demo1 cx.getBean("demo1"System.out.println(demo1;12.3新建一個(gè)demo1.xml配置文件xml version="1.0" encoding="UTF-8"?><beans xmlns=xmlns:xsi=xmlns:p=xmln

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論