日期:2014-05-20  浏览次数:20645 次

求看看这道面试题目
QUESTION NO: 6  
  Which two are equivalent? (Choose two)  
  A. <%= YoshiBean.size%>  
  B. <%= YoshiBean.getSize()%>  
 C. <%= YoshiBean.getProperty("size")%>  
  D. <jsp:getProperty id="YoshiBean" param="size"/>  
  E. <jsp:getProperty name="YoshiBean" param="size"/>  
  F. <jsp:getProperty id="YoshiBean" property="size"/>  
  G. <jsp:getProperty name="YoshiBean" property="size"/>  
答案是什么? 坐等结果 和解释

------解决方案--------------------
JSP 语法
<jsp:getProperty name="beanInstanceName" property="propertyName" /> 
B. <%= YoshiBean.getSize()%>
BG
------解决方案--------------------
kao,居然不会
------解决方案--------------------
排除法 C G

应该是jsp语法
 获取参数 值的2个方法
------解决方案--------------------
BG
<%= YoshiBean.getSize()%> //调用YoshiBean对象的getSize()方法

<jsp:getProperty name="YoshiBean" property="size"/>
//从web作用域里取出名称为YoshiBean然后调用其size属性(即通过反射调用其getSize()方法)。前提就是web作用域必须要有,一般可以和<jsp:userBean>或<jsp:setProperty> 联合使用。如:
<jsp:useBean id="YoshiBean" class="xx.xx.xx.YoshiBean" scope="page"></jsp:useBean>
<jsp:setProperty property="size" name="YoshiBean" />