This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Which of the following are valid JSP code fragments? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Which of the following are valid JSP code fragments?" Watch "Which of the following are valid JSP code fragments?" New topic
Author

Which of the following are valid JSP code fragments?

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
<%@ page import="java.util.*" autoFlush="true"%>
<%@ page import="java.io.*" autoFlush="false"%>

This is from enthuware.

According to me the the above should be correct. But i don't know why it is wrong?


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

You can have multiple import attribute of page directive,but you can not have multiple "autoFlash" attribute.

Infact only import is the only attribute which can be duplicated.


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Sanchita Srivastava
Ranch Hand

Joined: Jul 30, 2008
Posts: 51
yes its true.we cant define Autoflush twice in a jsp page.

org.apache.jasper.JasperException: /hello.jsp(8,0) Page directive: illegal to have multiple occurrences of autoFlush with different values (old: true, new: false)


SCJP 1.4<br />SCWCD 1.5 <br />searching for Job
Joy Mukherjee
Ranch Hand

Joined: Aug 10, 2008
Posts: 62
However yu can have this directive in 2 different x and y files and
from x do a
<jsp:include page="y.jsp"/>

however cannot do
<%@ include file="y.jsp"%>

Thanks and Regards
JOy


B.Tech (E.E),IIT Kharagpur<br />SCJP 5.0<br />SCWCD 5.0<br />PMP
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
When we say we can have multiple import attribute's, does that mean we use it like this

<%@page import ='java.util.*' import ='java.io.*'%>

Is this what means to have multiple import attribute's?
Sanchita Srivastava
Ranch Hand

Joined: Jul 30, 2008
Posts: 51
multiple imports must be like..
<%@ page import="java.util.*, java.lang.*" %>
please check the following sun link http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html
Joy Mukherjee
Ranch Hand

Joined: Aug 10, 2008
Posts: 62
Multiple import means same page has

<%@page import ='java.util.*' %>
<%@page import ='java.io.*'%>


Thanks and Regards
Joy
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Joy,

This is wrong answer from Enthuware.

<%@ page import="java.util.*" autoFlush="true"%>
<%@ page import="java.io.*" autoFlush="false"%>



And below your replie's says this. I am confused here. Is the above answer wrong because we first used autoFlush="true"
and then we used autoFlush="false"
-----------------------------------------------------------------
Multiple import means same page has

<%@page import ='java.util.*' %>
<%@page import ='java.io.*'%>

---------------------------------------------------------------------
Joy Mukherjee
Ranch Hand

Joined: Aug 10, 2008
Posts: 62
You cannot use multiple "page directive with autoFlush attribute".
So Enthuware is correct that the answer is wrong.
However you can use
multiple page directive with the import attribute.Only import attribute is allowed with multiple page directive.
I hope this clears your doubt.


Thanks and Regards
Joy
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Thanks's Joy..
 
Don't get me started about those stupid light bulbs.
 
subject: Which of the following are valid JSP code fragments?