• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:useBean

 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use nested <jsp:useBean> in other wordrs one in another.

if yes

what suould we do when a top side bean's scope is session and inside benas scope page.
does it mean once session is timed-out page scoped variable also go invisible?

regards,
rahul
[ November 08, 2006: Message edited by: Rauhl Roy ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rauhl Roy:
Can I use nested <jsp:useBean> in other wordrs one in another.


To what purpose? Given what <jsp:useBean> does, what semantics would be applied to nesting?
[ November 08, 2006: Message edited by: Bear Bibeault ]
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we write like this? as in core java classes



<jsp:useBean id="first" class="start" scope="session">
<jsp:getProperty ...... />

<jsp:useBean id="second" class="sec" scop="page">
<jsp:getProperty ...... />
</jsp:useBean>
</jsp:useBean>
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we write like this as in core java classes?



<jsp:useBean id="first" class="start" scope="session">
<jsp:getProperty ...... />

<jsp:useBean id="second" class="sec" scop="page">
<jsp:getProperty ...... />
</jsp:useBean>
</jsp:useBean>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
What happened when you tried it?


No, it is not working?

means, a bean can not have another bean with in it right!.

In other words, we are supposed to use the beans for getting the data,get(), and setting the data, set(), only?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still not sure how to answer that since I don't know what behavior you expect nesting one useBean action inside another to do for you.
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may i know can we wirte it?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, you can test this yourself. But you have still not explained what you are trying to accomplish with nesting the usebean actions. What benefit are you trying to get from nesting?
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i was just trying to know if jsp:useBean works just as normal class or not.
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't use the getProperty inside useBean because the bean must be created first before accessing it. so you should always have the getProperty element outside useBean
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have only <jsp:setProperty> inside aa usebean action. As said above, the bean must exist before its property could be get or else the container wont know what you are talking about. Check page 347 in the HFSJ book.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!