Page 1 of 1

About Question enthuware.jwpv6.2.958 :

Posted: Sun Mar 09, 2014 1:56 pm
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)

Re: About Question enthuware.jwpv6.2.958 :

Posted: Sun Mar 09, 2014 7:20 pm
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)

Re: About Question enthuware.jwpv6.2.958 :

Posted: Sun Mar 09, 2014 9:22 pm
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