英语和jsp好的高手进!拜托了

aiweier1986 2009-03-15 12:55:17
第一题
Your web application has a valid dd with a single <security-constraint> tag.
Within this tag exists:
- a single http method that declares GET
All of the resources in your application exist within directory1 and directory2 and the only defined roles are BEGINNER and EXPERT.
If you want to restrict BEGINNERs from using resources in directory2, which are true about the url and role tag(s) you should declare? (Choose all that apply.)
A. A single url tag should declare directory1 and a single role tag should declare EXPERT.
B. A single url tag should declare directory2 and a single role tag should declare EXPERT.
C. A single url tag should declare directory1 and a single role tag should declare BEGINNER.
D. A single url tag should declare directory2 and a single role tag should declare BEGINNER.
E. One url tag should declare ANY and its role tag should declare EXPERT, and another url tag should declare directory2 and its role tag should declare BEGINNER.
F. One url tag should declare both directories, and its role tag should declare EXPERT, and another url tag should declare directory1 and its role tag




上题为什么不选B(正确答案为D),题中要求限制BEGINNER啊,D选项不等于容许BEGINNER访问吗?



第二题
Given:
01. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
02.
03. <%
04. java.util.List books = new java.util.ArrayList();
05. // add line here
06. request.setAttribute("myFavoriteBooks", books);
07. %>
08.
09. <c:choose>
10. <c:when test="${not empty myFavoriteBooks}">
11. My favorite books are:
12. <c:forEach var="book" items="${myFavoriteBooks}">
13. <br/> * ${book}
14. </c:forEach>
15. </c:when>
16. <c:otherwise>
17. I have not selected any favorite books.
18. </c:otherwise>
19. </c:choose>
Which of the following lines of code, if inserted independently at Line 5, will cause the text within the c:otherwise tag to display? (Choose all that apply)
A. books.add("");
B. books.add(null);
C. books.clear();
D. books.add("Head First");
E. books = null;



答案是B、D,我十分不解为啥会选D,我认为C也对啊,E将books置为Null也可以通过empty的测试啊
第三题
<%= out.print('${something}')>这样对吗?EL可以写在里面吗?


欢迎高手前来赐教,感激不尽!
...全文
106 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiweier1986 2009-03-15
  • 打赏
  • 举报
回复
这是java web 开发师的考试题
aiweier1986 2009-03-15
  • 打赏
  • 举报
回复
楼上的兄弟你也第一二题答错了啊,尤其第二题你为嘛不答B项孽?
aiweier1986 2009-03-15
  • 打赏
  • 举报
回复
谢谢喽
「已注销」 2009-03-15
  • 打赏
  • 举报
回复
空手套白狼啊。
yuxiaokill 2009-03-15
  • 打赏
  • 举报
回复
问题2我测试的结果是C E
什么都不能 2009-03-15
  • 打赏
  • 举报
回复
1是用容器提供的安全策略,一般都是提供几个虚拟角色,然后定义每个角色可以访问的资源
<security-constraint>
<web-resource-collection>
<web-resource-name>ProtectedResource</web-resource-name>
<description>
These resources are only accessible by authorized users
</description>
<url-pattern>*.do</url-pattern>
<url-pattern>*.screen</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<!-- 定义那些角色可以访问受限资源,可以经过UM认证自动产生这段设置; -->
<!-- 可以为 * 或者任意名称;当不是* 时必须跟 security-role下的role-name 设置相同 -->
<role-name>pafaDemoUser</role-name>
</auth-constraint>
<user-data-constraint>
<description>
This is how the user data must be transmitted
</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>default</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginerror.jsp</form-error-page>
</form-login-config>
</login-config>

<security-role>
<!-- 定义能访问系统的角色,经过UM认证后是可以产生这段配置的 -->
<!-- 可以是UM中定义的某个角色或角色组 -->
<!-- 也可以是跟auth-constraint下的role-name 设置相同的值,此时必须跟weblogic.xml 中 security-role-assignment下的 role-name名称相同 -->
<role-name>pafaDemoUser</role-name>
</security-role>
这是一个demo系统中的设置
2,我更是不解null作为一个空对象,也是list中的一个item怎么会跳转到otherwise呢?如果选B为什么不选AD呢?
你可以试一下当按B做的时候,输出My favorite books are: *null 而不是I have not selected any favorite books.
什么都不能 2009-03-15
  • 打赏
  • 举报
回复
这是哪门子的题?
1,我选B directory2受保护,访问权限组EXPERT
2, 我选CE
3, 不能

81,077

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧