About Question enthuware.jwpv6.2.958 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
thituba20
Posts: 3
Joined: Mon Feb 24, 2014 4:47 pm
Contact:

About Question enthuware.jwpv6.2.958 :

Post by thituba20 »

Hello Guys,

I was testing this question because I failed and I saw that explanation about this question is wrong. The explanation about include directive

Code: Select all

<@ include file=...
or

Code: Select all

<jsp:directive.include>
says:

'Fact 2: Any page directive attribute except import can occur at most once in a translation unit.

Now, in this question, both the including and the included files have an errorPage directive. Thus, the resulting including file (companyhome.jsp) will contain 2 errorPage directives, which is wrong.'

Code: Select all

//In file companyhome.jsp: 
<html>
<body> 
Welcome to ABC Corp! 
<%@ page errorPage="simpleerrorhandler.jsp" %> 
<%@ include file="companynews.jsp" %> 
</body>
</html>   

//In file companynews.jsp: 
<%@ page errorPage="advancederrorhandler.jsp" %> 
<h3>Todays News</h3>
About Fact 2, I say YES, Any page directive attribute can occur more that once in a translation unit. If you include the same error page in errorPage (companyhome.jsp or simpleerrorhandler.jsp) in both pages this works perfectly.

Code: Select all

//In file companyhome.jsp: 
<html>
<body> 
Welcome to ABC Corp! 
<%@ page errorPage="[color=#FF0000]simpleerrorhandler.jsp[/color]" %> 
<%@ include file="companynews.jsp" %> 
</body>
</html>   

//In file companynews.jsp: 
<%@ page errorPage="[color=#FF0000]simpleerrorhandler.jsp[/color]" %> 
<h3>Todays News</h3>
Best Regards,
Thiago (Brazil)

thituba20
Posts: 3
Joined: Mon Feb 24, 2014 4:47 pm
Contact:

Re: About Question enthuware.jwpv6.2.958 :

Post by thituba20 »

I'm sorry, but I wrote wrong in page of errorPage.

The correct is:

Code: Select all

<%@ page errorPage="simpleerrorhandler.jsp" %>

Best Regards,
Thiago (Brazil)

admin
Site Admin
Posts: 10068
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.958 :

Post by admin »

Yes, as per section JSP 1.10.1 in JSP Specification:
There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for the duplicate attributes are identical for all occurrences.
But in the question the values of the errorPage are not identical in both the pages. Explanation has been enhanced to make it clear.

thank you for your feedback!
Paul
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 136 guests