Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

JSP Implicit Objects

Thread view: 
marcwentink@hotmail.com - 25 Jul 2006 13:41 GMT
I am reading something about JSP Implicit Objects, objectslike for
example:

request,  response, pageContext, application, out, session

But then my tekst book says:

---------------------------------------------------------------------------------
Note that these implicit objects are only visible within the system
generated
_jspService() method. They are not visible within methods you define
yourself in
declarations.
-------------------------------------------------------------------------------

Ok, then this means I cannot use them? If so why mention them anyway?
Can you use them somehow?

Marcus Wentink
relipse@gmail.com - 25 Jul 2006 14:19 GMT
it is easy to use them, you don't have to write methods in a JSP file
for example
<%

if ( "true".equals(request.getParameter("largetext")))
  out.println("<font size=7>LARGE TEXT</font>");

%>

one thing I did when I wrote a method was to pass in the request as a
parameter...
for example...

<%!

public boolean isLargeText(HttpServletRequest request)
{
  return "true".equals(request.getParameter("largetext"));
}

%>

then you can write this code below where you need it

<%

if ( isLargeText(request) )
  out.println("<font size=7>LARGE TEXT</font>");

%>

hope this helps

-ReLipse
Xhirl Software Design
www.xhirl.com/software

> I am reading something about JSP Implicit Objects, objectslike for
> example:
[quoted text clipped - 15 lines]
>
> Marcus Wentink
marcwentink@hotmail.com - 25 Jul 2006 14:39 GMT
relipse@gmail.com schreef:

> one thing I did when I wrote a method was to pass in the request as a
> parameter... for example...

Ok so the text in the book tries to explain that if you use it in a
function you defined, the object is not there, unless you have passed
it as a parameter.....since in this defined function you are in another
scope.

In 'normal' java code snippets in JSP files on the other hand, they are
available.

Bad bad book!

Thanks a lot!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.