This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

couple mock exam questions

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%! int i; %> is a variable declaration that has object scope within the servlet.

I suppose that this is true.

But what is difference from object scope vs. class scope? The term object scope is new to me. I guess object scope means instance, and class scope means class variables like statics. is that right?

===

<%= "Hello " + userName %>

the answer says that this is an example of jsp Expression.
I suppose this is also an example of scriptlet since scriptlet includes expressions, is that right?

===

Servlets that implement the SingleThreadModel cannot share a
single HttpSession Object accross multiple servlets.

the answer says that this is false. But I think this is a true statement.

I did not understand this, SingleThreadModel guarantees one single thread per Servlet, but there may be more than one thread as long as there are multiple servlets. If so, HttpSession is not protected against that.

Thanks.
Yan
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On first question you are right about class vs instance variable .
On second you are too . Expression is a scriptlet .
On third , the container can intantiate more than none servlet if the servlet implements SingleThreadModel . A client makes a request and a Session is created with a sessionId that will de send back to the client . on second request the client send the sessionId back and the container checks if there is a Session with the sessionId .
I think that helps
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic