• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubts in ELExpression

 
naresh govindaswmay
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen when you attempt to compile and run the following JSP page contents?


<%request.setAttribute("Two","2");
Integer One = new Integer(1);
%>${One + 1}
${Two}
${Two + 1}

Choose one answer.
a. 1 2 3
b. 2 2 3
c. 1 1
d. 1 null 1
I have found this question in MarcusGreen Page.I have mark B is the answer,because One is not an Attribute so it will not return.They said C is the answer.Please check it and clear the doubts.
 
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 naresh govindaswmay:
I have mark B is the answer,because One is not an Attribute so it will not return.

If that is your reasoning, shouldn't you have marked A as the correct answer?
 
Prasad Shindikar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer should be option a: 1 2 3.
Option c cannot possibly be the answer, since ${Two}, will always print 2.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic