問題詳情
Explanation Exception is a JSP implicit variable The exception variable contains any Exception thrown on the previous JSP page with an errorPagedirective that forwards to a page with an isErrorPage directive. Example: If you had a JSP (index.jsp) which throws an exception (I have deliberately thrown aNumberFormatException by parsing a String, obviously you wouldn't write a page that does this, itsjust an example) <%@ page errorPage="error.jsp" %> <% Integer.parseInt("foo"); //throws an exception %> This will forward to error.jsp, If error.jsp was <%@ page isErrorPage = "true"%> <body> <h2>Your application has generated an error</h2> <h3>Please check for the error given below</h3> <b>Exception:</b><br><font color="red"><%= exception.toString() %></font> </body> Because it has the <%@ page isErrorPage = "true"%> page directive, the implicit variable exception will contain the Exception thrown in the previous jsp Sowhen you request index.jsp, the Exception will be thrown, and forwarded to error.jsp which willoutput html like this <body> <h2>Your application has generated an error</h2> <h3>Please check for the error given below</h3> <b>Exception:</b><br> <font color="red">java.lang.NumberFormatException: For input string: "foo"</font> </body> As @JB Nizet mentions exception is an instanceof Throwable calling exception.getMessage() Forinput string: "foo" instead of java.lang.NumberFormatException: For input string: "foo"
94 Given this fragment in a servlet: 23. if(reg.isUserInRole("Admin")) { 24. // do stuff 25. } And the following fragment from the related Java EE deployment descriptor: 812. <security-role-ref> 813. <role-name>Admin</role-name> 814. <role-link>Administrator</role-link> 815. </security-role-ref> 900. <security-role> 901. <role-name>Admin</role-name> 902. <role-name>Administrator</role-name> 903. </security-role> What is the result?
(A) Line 24 can never be reached.
(B) The deployment descriptor is NOT valid.
(C) If line 24 executes, the user's role will be Admin.
(D) If line 24 executes, the user's role will be Administrator.
(E) If line 24 executes, the user's role will NOT be predictable.
94 Given this fragment in a servlet: 23. if(reg.isUserInRole("Admin")) { 24. // do stuff 25. } And the following fragment from the related Java EE deployment descriptor: 812. <security-role-ref> 813. <role-name>Admin</role-name> 814. <role-link>Administrator</role-link> 815. </security-role-ref> 900. <security-role> 901. <role-name>Admin</role-name> 902. <role-name>Administrator</role-name> 903. </security-role> What is the result?
(A) Line 24 can never be reached.
(B) The deployment descriptor is NOT valid.
(C) If line 24 executes, the user's role will be Admin.
(D) If line 24 executes, the user's role will be Administrator.
(E) If line 24 executes, the user's role will NOT be predictable.
參考答案
無參考答案
內容推薦
- 92 You are building your own layout mechanism by including dynamic content for the page'sheader
- 93 You are working on a JSP that is intended to inform users about critical errors in the system.The
- 下列何者並非貿易實務上常見的索賠?(A)買賣索賠(B)匯兌損失索賠(C)運輸索賠(D)保險索賠。
- 根據下圖,當 e1=e2 且 V0=0,RL1 與 RL2 之阻值應 (A)相差 20 倍(B)相等(C)相差 10 倍(D)相差 30 倍。
- 臺北捷運車輛進站時,車廂內偶而會有音樂聲響起,請問其目的為何?(A)視障乘客搭車方向 (B)提醒車門即將開啟 (C)提醒視障乘客到站了 (D)轉乘站或終端站到了。
- 下列有關臺北捷運系統高運量系統之營運列車技術特性說明,何者有誤?(A)動力供電系統為第三軌 750V 直流供電 (B)每一列車由 2 組三節電聯車廂(EMU)所組成 (C)每一列車共有 8 組
- 當車站發生緊急事故須疏散旅客出站時,有關車票之退票規定,下列何者正確?(A)單程票限購票日後五日內退票 (B)單程票於當日起算 1 個月內請求退還全部票價 (C)電子票證於下次進站時自動免費更
- 假設某一捷運路線的路線容量為每小時 16000 人,班距 6 分鐘。假設車輛供給無虞,若要將容量提升為每小時 24000 人,則班距應該調整為何?(A)3 分鐘 (B)4 分鐘 (C)5
- 根據捷運旅客須知,臺北捷運系統能否拒絕運送?(A)捷運屬公共大眾運輸系統,不得拒絕運送 (B)服裝儀容不整者得拒絕運送 (C)為免醫療糾紛,重病患者得拒絕運送 (D)有明顯騷擾他人行為者得拒絕
- 現在臺北捷運系統使用可加值電子票證的普通卡搭車,有何優惠?(A)每次扣款與單程票相同 (B)八折扣款優惠 (C)九折扣款優惠(D)九五折扣款優惠。
內容推薦
- 編號 7924 為穩壓 IC,其穩壓輸出值為:(A)+24 V(B)-24 V(C)-5V(D)+5V。
- 若勞工工作性質需與陌生人接觸、工作中需處理不可預期的突發事件或工作場所治安狀況較差,較容易遭遇下列何種危害?(A)潛涵症(B)多發性神經病變(C)組織內部不法侵害(D)組織外部不法侵害。
- 閱讀下列新詩,依據文意推斷,文中□內,依序應填入:「如果愛情向我舉杯/我怎能一□而盡/凝視水晶杯/折射每個角度的你/你是我舌尖的/一□酒/一□淚/一□無法分解的/醉(洪淑苓〈醉〉)(A)滴/盅/
- 下列選項,何者不是書信中給親友長輩的結尾祝賀語?(A)恭請 崇安(B)敬頌 崇祺 (C)敬請 崇安 (D)順頌 時祺。
- 〈漁父〉一文中,漁父建議屈原:「聖人不凝滯於物,而能與世推移。」以下看法與之最相近的是:(A)守璞藏真 (B)力挽狂瀾 (C)隨俗方圓 (D)自命清高。
- 題辭是表達對人稱頌、讚美、祝賀或哀悼的簡短語句。以下題辭使用的對象,何者恰當?(A)賀開業:麟趾呈祥 (B)賀當選:功在桑梓 (C)賀新居:光耀門楣 (D)賀榮退:寸草春暉。
- 李清照〈夏日絕句〉:「生當作人傑,死亦為鬼雄。至今思□□,不肯過江東。」詩中讚頌肯定此人物為真英雄。□□應填入的是?(A)孔明 (B)劉備 (C)張良 (D)項羽。
- 「柴桑古村落,栗里舊山川。不見籬下菊,空餘墟里煙。子孫雖無聞,族氏猶未遷。每逢陶姓人,使我心依然。」詩中令作者有感而發的人物是:(A)李白 (B)杜甫 (C)蘇東坡 (D)陶淵明。
- 「不論平地與山尖,無限風光盡被占。採得百花成蜜後,為誰辛苦為誰甜。」上述詩作所描寫歌詠的對象是:(A)蜂 (B)蝶(C)燕 (D)鶯。
- 下列詩句,何者描寫的是柳樹?(A)遙知不是雪,為有暗香來 (B)碧玉妝成一樹高,萬條垂下綠絲絛 (C)暗暗淡淡紫,融融冶冶黃 (D)咬定青山不放鬆,立根原在破岩中。
- 下列詩句,何者屬於工整的「對仗」?(A)星垂平野闊,月湧大江流 (B)夜來風雨聲,花落知多少 (C)夕陽無限好,只是近黃昏 (D)待到重陽日,還來就菊花。
- 閱讀下文,回答 14-15 鄭板橋詩:「不風不雨正晴和,翠竹亭亭好節柯。最愛晚涼佳客至,一壺新茗泡松蘿。幾枝新葉蕭蕭竹,數筆橫皴淡淡山。正好清明連穀雨,一杯香茗坐其間。」【題組】這首詩是描寫的
- 〈看海的日子〉、〈兒子的大玩偶〉是哪一位作家的作品?(A)楊逵 (B)賴和 (C)黃春明 (D)鍾理和。
- 【題組】下列選項,和鄭板橋此詩所描述的心情,最接近的是:(A)纏綿揪心 (B)閒適隨意 (C)慵懶倦情 (D)興奮昂揚。
- 閱讀下文,回答 16-17 每座廟,都有個籤筒。我們宜蘭媽祖宮裡,有兩個暗金色的銅鑄大籤筒,筒中插滿一大把竹籤。每一枝閃著油亮的竹籤,都可以到籤櫃裡去兌出一首籤詩──或人世的悲喜、或天象的旱澇
- 【題組】閱讀上文,下列敘述何者正確?(A)籤詩中的文字和戲文呼應而寄託深意(B)廟宇的籤筒象徵神佛給予人們的警惕(C)人們藉由籤詩得到心靈的安定與平穩(D)傳遞竹籤的儀式能夠獲得神佛的保佑。
- 「躬逢其盛」一詞中「躬」的意思是:(A)恭敬 (B)親身 (C)委屈 (D)敬禮。
- 成語中有運用動物來描寫或比喻,以傳達人事的意念或情感者。下列何者形容「貪得無厭」:(A)盲人瞎馬(B)鼯鼠技窮 (C)巴蛇吞象 (D)吳牛喘月。
- 「梅以曲爲美,直則無姿;以欹爲美,正則無景」,句中「欹」的意思是:(A)傾斜 (B)高大 (C)細緻 (D)肥碩。
- 下列史書何者為編年史?(A)史記 (B)漢書 (C)左傳 (D)三國志。
- 蘇軾曾評論為「文起八代之衰,道濟天下之溺」,是哪一位文人?(A)杜甫 (B)韓愈 (C)歐陽脩 (D)司馬遷。
- 依稅捐稽徵法規定,營利事業因合併而消滅時,其在合併前之應納稅捐,應由下列何者負擔? (A)因合併而消滅之公司 (B)合併後另立之公司 (C)合併前各別之公司 (D)皆不須繳納。
- 參加表姐的結婚典禮,應該送上下列哪一項祝賀詞?(A)雀屏中選 (B)椿萱並茂 (C)桃開連理 (D)宜室宜家。
- 閱讀下面的現代詩,並推斷詩中描述的對象是?秋天/最容易受傷的記憶/霜齒一咬/噢/那樣輕輕/就咬出一掌血來(A)菊花 (B)山嵐 (C)楓葉 (D)晚霞。
- 最強調「非攻」是「九流十家」中的:(A)法家(B)名家(C)儒家(D)墨家