日期:2014-05-18  浏览次数:20676 次

有个JSP的考试题目,谢谢!
1.public   void   doPost(HttpServletRequest   request,HttpServletResponse   response)   throws   ...
{
    request.getSession().getAttribute( "A ");  
}
问:如果request.getSession().getAttribute( "A ");   返回的对象应用不是null,那么这个对象存储在()范围中
a.page   b.session   c.request   d.application

2.在使用JSP自定义标签时,给定如下web应用结构
/web-inf/tags/mytags/tag1.tag
/web-inf/tags/tag2.jsp
/web-inf/tag3.tag
/tag4.tag
以下()标签可以用于taglib指令中(选择两项)
a.tag1.tag     b.tag2.tag     c.tag3.tag     d.tag4.tag
这个题目我知道d肯定不正确,但是我不知道abc哪2个是正确的?为什么?


------解决方案--------------------
1:b 2:ac
------解决方案--------------------
1.b
2.a,c
第二题:/web-inf/tags/tag2.jsp中的.jsp是笔误还是什么??如果不是笔误就肯定是a,c啊
------解决方案--------------------
同楼上二位

------解决方案--------------------
第一题选B,不多说了。
第二题应该选A、B。因为tag文件只能被部署在/WEB-INF/tags或者它的子目录下。
《SCWCD Exam Study Kit 2nd Edtion》
17.3.2 Tag files and TLDs
In the example JSP above, the tagdir attribute is set to /WEB-INF/tags. This is necessary since the web container automatically looks there for tag files. Then, the
container builds an implicit tag library and TLD for this directory and each subdirectory beneath it. The good news is that you don’t have to create TLDs for tag files. The bad news is that your tag files must be in /WEB-INF/tags/ or a subdirectory.
注意上文最后一句。
------解决方案--------------------
同意楼上的
------解决方案--------------------
没错