当前位置: 首页 > news >正文

自己怎么优化网站排名专业网页网站设计图书

自己怎么优化网站排名,专业网页网站设计图书,洋气的广告公司名字,网站建设协议需要注意的问题级联属性赋值(了解) 概述 级联属性赋值就是给某个对象属性的属性赋值,就是给对象关联的对象的属性赋值 Clazz班级类 public class Clazz {private String name;public Clazz() {}public Clazz(String name) {this.name name;}//set和get方法以及toString方法 }Student有cl…级联属性赋值(了解) 概述 级联属性赋值就是给某个对象属性的属性赋值,就是给对象关联的对象的属性赋值 Clazz班级类 public class Clazz {private String name;public Clazz() {}public Clazz(String name) {this.name name;}//set和get方法以及toString方法 }Student有clazz属性,表示学生属于哪个班级 public class Student {private String name;private Clazz clazz; // 要想给clazz属性采用级联属性赋值其必须提供getter方法public Clazz getClazz(){return clazz;}public Student() {}public Student(String name, Clazz clazz) {this.name name;this.clazz clazz;}//set和get方法以及toString方法}采用一般方式直接给Clazz对象的属性赋值 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd!--采用一般方式直接给班级对象的属性赋值--bean idclazzBean classcom.powernode.spring6.bean.Clazzproperty namename value高三一班//bean /beans使用级联属性给Clazz对象的属性赋值需要注意两点 Student类的clazz属性必须提供getter方法,只有这样Spring才能通过调用getClazz()方法拿到对应的Clazz对象然后给它的name属性赋值标签配置的顺序不能颠倒: 在Student对象中只有先给clazz属性赋值后,我们才能拿到对应的Clazz对象然后给它的name属性赋值 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd!--使用级联属性通过给Student对象关联的对象的属性赋值--bean idstudent classcom.powernode.spring6.beans.Student!--简单类型使用value属性--property namename value张三/!--先给Student的clazz属性赋值--property nameclazz refclazzBean/!--然后调用getClazz()方法拿到clazz属性对应的Clazz对象,然后给它的name属性赋值--property nameclazz.name value高三一班//beanbean idclazzBean classcom.powernode.spring6.beans.Clazz/ /beans测试程序 Test public void testCascade(){ApplicationContext applicationContext new ClassPathXmlApplicationContext(spring-cascade.xml);Student student applicationContext.getBean(student, Student.class);System.out.println(student); }注入null和空字符串和特殊字符 注入空字符串 注入空字符串使用value/标签或指定属性value public class Vip {private String email;public void setEmail(String email) {this.email email;}Overridepublic String toString() {return Vip{ email email \ };} }?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idvipBean classcom.powernode.spring6.beans.Vip!--空串的第一种方式--property nameemail value/!--空串的第二种方式--property nameemailvalue//property/bean/beans注入null 注入null使用null/标签或者不为该属性赋值 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd!--第一种方式:不给属性赋值(默认就是null)--bean idvipBean classcom.powernode.spring6.beans.Vip /!--第二种方式:使用null/标签--bean idvipBean classcom.powernode.spring6.beans.Vipproperty nameemailnull//property/bean/beans注入的值中含有特殊符号 XML中有5个特殊字符、、、、 : 它们在XML中会被当做XML语法的一部分进行解析所以不能直接出现在value的属性值当中 第一种使用转义字符代替特殊符号: (gt;)、(lt;)、(apos;)、(quot;)、(amp;) public class Math {private String result;public void setResult(String result) {this.result result;}Overridepublic String toString() {return Math{ result result \ };} }?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idmathBean classcom.powernode.spring6.beans.Math!--注入23--property nameresult value2 lt; 3//bean /beans第二种在value标签中将含有特殊符号的字符串当作普通字符串处理: ![CDATA[含特殊字符的串]] 中的数据不会被XML文件解析器解析 使用![CDATA[含特殊字符的串]]时不能使用value属性,只能使用value标签- ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idmathBean classcom.powernode.spring6.beans.Mathproperty nameresult!--使用CDATA时不能使用value属性只能使用value标签--value![CDATA[2 3]]/value/property/bean /beans测试程序 Test public void testSpecial(){ApplicationContext applicationContext new ClassPathXmlApplicationContext(spring-special.xml);Math mathBean applicationContext.getBean(mathBean, Math.class);//Math{result2 3}System.out.println(mathBean); } SpEL(Spring Expression Language) Spring表达式语言 使用property标签的value属性给简单类型的属性赋值时可以在#{}的括号中使用SpEL表达式 表达式内容#{12345.67*12}含运算符的字面量, 支持使用任何运算符#{book01.bookName}引用其他的bean的某个属性值#{car}引用其他的bean的id#{T(全类名).静态方法名(实参)}调用静态方法#{ 对象bean.非静态方法名(实参) }调用非静态方法 bean idbook01 classcom.atguigu.bean.Bookproperty namebookName valuebook1/property /bean bean idperson classcom.atguigu.bean.Person!--字面量:使用运算符--property namesalary value#{12345.67*12}/property!--引用其他bean的某个属性值--property namelastName value#{book01.bookName}/property!--引用其他bean,也可以使用ref属性应用--property namecar value#{car}/property!--调用静态方法:UUID.randomUUID().toString()--property nameemail value#{T(java.util.UUID).randomUUID().toString().substring(0,5)}/property!--调用非静态方法:对象.方法名--property namegender value#{book01.getBookName()}/property /bean
http://www.w-s-a.com/news/2976943/

相关文章:

  • 做设计比较好的网站游戏工作室网络组建方案
  • 学校建设服务网网站建设方案项目书织梦网站如何做软件下载
  • 没有网站怎样做搜索引擎推广肯达建设网站
  • seo网站排名厂商定制长沙如何做百度的网站推广
  • 极速建站系统开发吉利seo
  • 做水果的有什么网站黄骅港旅游景点大全
  • 宜黄建设局网站外发加工网app
  • 网站必须备案魏县网站建设推广
  • 个人做淘宝客网站有哪些如何做网站的的关键词
  • 织梦建设手机网站中山做网站哪家便宜
  • 这几年做那些网站致富网站建设品牌好
  • 网站策划名词解释沧州网站推广优化商集客电话
  • 网站集约化建设管理方案河南省建设厅专家库
  • 网站建设开发公司定制网站制作宁波建设银行
  • 公司网站做一年多少钱免费建设网站哪个好
  • 云南网站建设快速排名wordpress百度站长验证
  • 网页具有动画网站建设技术高埗镇仿做网站
  • 如何在百度上做网站推广接单赚钱平台
  • 北京网站建设华大宜春市建设局网站
  • 网站如何做死链接提交h5制作开发价目表
  • 网站中医建设ui设计师的工作内容包括哪些
  • 深圳网站开发外包互联网100个创业项目名称
  • 免费网站空间申请苏州快速建设网站公司
  • 东风多利卡道路清障车做网站太原网站开发模板
  • 国外门户网站有哪些一键生成ppt的软件
  • 教育类网站 前置审批租一个服务器多少钱
  • 成都网站设计公司官网wordpress怎么让图全屏显示
  • 国外的建筑设计网站网站开发中点赞怎么做到的
  • 定西地网站建设完整源码
  • 网站建设设计制作外包在网站建设中经历的流程