Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Senthil Nathan.s

Greenhorn
+ Follow
since Jan 04, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Senthil Nathan.s

Hi,
I have one doubt in JAVAbeans from HFSJ book in scriptfree pages chapter.
This question occcurs inbetween the chapter.

Question:<jsp:useBean id="person" type="Foo.Employee">

<jsp:setProperty name="person" property="name" value="fred"/>
</jsp:useBean>
Name is :<jsp:getproperty name= "person" property="name"/>


Now what will happen if this jsp page comes after following servlet

i)Foo.Person=new Foo.Employee();
p.setName("evan");
request.setAttribute("person",p);


ii) foo.Employee p= new Foo.Employee();
p.setName("evan");
request.setAttribute("person",p);

Employee is the concrete class and it inherits Person class.Person is an abstract class.

Now the answer given in the book is
i)will not evaluate because the attribute is in request scope but the useBean tag searches in the page scope.



ii)This works fine.


I can understand the first answer but i expect the same answer for the ii) one also but why does it evaluates fine.Can anyone explain me this.....
Hi,
I think because simple tags are going to handle the contents of the body as JSP Fragments since scripting is not allowed in JSPFragments it is not allowed in simple tags.But in Classic tags bodycontent object is used to handle the contents so i think JSP is allowed in classic tags.


Please correct me If I am wrong.
please specify the location and the mail id where we should mail the resume
14 years ago
Hai I have one year experience in java.I have done my SCJP last month.Currently I am preparing for SCWCD and I will be cetified by the month of march.I passed my B-tech(ece) from ANNA UNIVERSITY(MADRAS INSTITUTE OF TECHNOLOGY)with 9.2 CGPA.
I am working with TCS for the past one year in mumbai.I am preffering chennai as my work location.I .If there is any requirement please send me a personal mail to subash_sen2985@yahoo.com


with regards
senthilnathan.s
14 years ago
Hai I am I year experienced in JAVA and passed SCJP with(90%).Currently I am preapring for SCWCD and I will get certified by March.Now i am in Mumbai and I like to work in Chennai.I have an excellent academic record.So if there is any job offerings please send me a personal mail to subash_sen2985@yahoo.com
14 years ago
Ramesh you please look into the tricky question posted by me.I also have the same doubt and we have a very good explanation over there.
Thanks for your explanation Murali.I understood the concept very well.
In both the cases s is stored on the stack and in the firstcase hello is stored on the string pool and in the second case hello is stored on both the heap and the string pool.
Thanks krishnan for your reply but anyhow the contents of i must be incremented by one know .You mean that the contents of i wont get incremented at all ,is it so.......
eg:
int i=10;
i=++i;
i=i++;
System.out.println(i);


doubt:
I expect the answer to be 12 but the answer is 11.Can anyone explain me how this happens


Thanks and regards
S.Senthilnathan