Results 1 to 2 of 2
  1. #1
    davis123877 is offline Member
    Join Date
    Feb 2015
    Posts
    9
    Rep Power
    0

    Default Implicit out in a JSP

    I am currently reading Head First Servlets and JSP. There is a question that states: If you are supposed to use expressions INSTEAD of putting out.println() into a scriptlet, then why use the implicit "out" there?

    The answer is: You probably won't use the implicit out variable from within your JSP page, but you might pass it to something else... some other object that's part of your app that does not have direct access to the output stream for the response.

    My question is: How do you pass the out object to another object in your app? What kind of object wouldn't have access to the out stream? Could you provide some simple code that would use this scenario? Thanks so much!

  2. #2
    davis123877 is offline Member
    Join Date
    Feb 2015
    Posts
    9
    Rep Power
    0

    Default Re: Implicit out in a JSP

    OK I think I understand what they are saying here. So if you have another object that might need to use the writer you could pass the out to that object. That object would have to have Javax.servlet.jsp.JspWriter as an instance or class variable, so you could pass the out in a constructor call. Is this basically what they are saying?

Similar Threads

  1. Implicit and Explicit casting
    By jmohandos304 in forum New To Java
    Replies: 9
    Last Post: 08-23-2014, 02:45 PM
  2. Confusion in implicit conversion
    By dojob in forum New To Java
    Replies: 5
    Last Post: 08-05-2013, 12:52 PM
  3. Implicit object in jsp declared where?
    By mahendra.athneria in forum JavaServer Pages (JSP) and JSTL
    Replies: 7
    Last Post: 08-11-2009, 02:23 PM
  4. Implicit objects
    By JavaJunkie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 05-20-2009, 06:21 AM
  5. JSP implicit objects
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •