• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Which of the following are valid JSP code fragments?

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%@ 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?
 
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Amandeep Singh
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Multiple import means same page has

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


Thanks and Regards
Joy
 
Amandeep Singh
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks's Joy..
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic