File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to restrict the container not to create the JSP implicit objects ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to restrict the container not to create the JSP implicit objects ?" Watch "How to restrict the container not to create the JSP implicit objects ?" New topic
Author

How to restrict the container not to create the JSP implicit objects ?

shanthi naidu
Ranch Hand

Joined: Nov 13, 2008
Posts: 39
Hi,

Recently in an interview i have been asked a question "how to disable the implicit objects in the jsp so that developer himself can create the objects whenever it is required, in other way how to restrict the container not to create the JSP implicit objects". Is it possible to restrict the container not to create the implicit objects? I would really like to know the answer for this.

Thanks & Regards,
Shanthi
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

I have not idea what these "implicit objects" are or what benefit one obtains by interfering with their normal usage.


Customer surveys are for companies who didn't pay proper attention to begin with.
Marshall Blythe
Ranch Hand

Joined: Feb 26, 2013
Posts: 32
I think he's referring to the various objects like request, response, session, page, etc. that the container makes available without explicit declaration. If you're going to disable these (assuming that's even possible) then you might as well write a static HTML page instead of a JSP. Where do interviewers come up with these fringe questions?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Stupidest. Interview question. Ever.

And no, I know of no way to do that, and cannot think of a scenario where it could possibly be appropriate or useful.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
shanthi naidu
Ranch Hand

Joined: Nov 13, 2008
Posts: 39
:D I thought it might be possible and i only dont know the answer thinking that inverviewer knows everything :-P ... anyways thank you for the replies and clarification.. keep rocking :)
syed yousuf
Greenhorn

Joined: Oct 13, 2012
Posts: 3

I don't think we can disable Implicit objects from JSP Container.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

syed yousuf wrote:I don't think we can disable Implicit objects from JSP Container.


I don't think we [i]should.[/b] Whatever they are supposed to be.

At any rate it's a good interview question. It shows that this shop is controlled by people who think that they are cleverer than they are and that you'll almost certainly be happier somewhere else. If for no other reason than not being there to blame when all this "clever" ends up being more trouble than it's worth.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

It sounds like one of those questions that should only be answered with another question: "Why would you want to do that?"
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
The only one I think you can restrict is the creation of a session via the page directive:
ie <%@ page session="false" %>

But that is for the use case where you don't WANT a session at all. There is no point in setting this property and then creating a session yourself.
(at least not a GOOD reason I can think of)

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to restrict the container not to create the JSP implicit objects ?