Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

more than one in bean in jsp page  RSS feed

 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have the following at the top of my jsp application.

<top:useBean id="bean" ^M
classname="com.title.bob.top.beans.RecordBean" ^M
scope="request"/>^M
is it ok for the page to refer to more than one bean ?if i wish to use an other bean do i simply add it below this one like this -
<top:useBean id="bean" ^M
classname="com.title.bob.top.beans.ColumnBean" ^M
scope="request"/>^M
cheers
chris
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except that you need to give them different id's obviously.
bear
 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Except that you need to give them different id's obviously.
bear

why is this ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give two variables in a Java program the same name?
Same reason. if you have two beans with the same name (id), how could tell them apart?
bear
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ids are nothing but variable names. You can see that ids cannot be dynamic i.e. it is statis because JSP compiler declares variables with the names passed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!