• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFS Coffe cram qn63 and qn53

 
bernard savary
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
In HFS mock exam , the qn#63 mentions that the listing is a complete jsp page and there is a <jsp:setProperty .../> without <jsp:useBean .../>
I suppose use of <jsp:setProperty /> without <jsp:useBean/> should generate a error . but the correct answer does not include the error for the above. Can someone pls explain ...
Also I could not understand the reasoning for Qn#53 . it will good if someone can help me understand that .

thanks!
 
bernard savary
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys ,

Appreciate if you'll could come up with some answers ...
 
Venkata Sunil Yadiki
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as Q 53 is concerned with httpSessionListener there is no method to get the user info.So using an attribute to store the username we can use httpSessionAttributeListener to start a session as soon as user login is authenticated. And regarding jsp:setProperty... yes there should be a jsp:useBean tag. This is given in the link below
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm13.html
 
Xavi Sanchez
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I don't like Q53 either. I've come to the conclusion that the question is assuming that you are using your own security stuff, not declarative security, as there is no requirement for the container to put the user in session... but even assuming this I don't like it...

In case it helps I've asked about this in
this other post

Other opinions?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Venkata Sunil Yadiki:
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm13.html

That documentation is a little misleading.

The JSP spec is more clear. It specifically says that the name attribute of jsp:setProperty refers to: "The name of a bean instance defined by a <jsp:useBean> action or some other action... The defining action must appear before the <jsp:setProperty> action in the same file." (bold mine)

That's a terrific catch you found about the jsp:setProperty. If you're able to notice something like that, you might as well give yourself full credit on that question. However, it is possible that the "mytags" actions may have set up the bean that the jsp:setProperty needs, which means the jsp:setProperty will not definitely generate an error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic