This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSP and the fly likes more than one in bean in jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "more than one in bean in jsp page" Watch "more than one in bean in jsp page" New topic
Author

more than one in bean in jsp page

Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
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


One day all greenhorns will run free ...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

Exactly!


Groovy
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56554
    
  14

Except that you need to give them different id's obviously.
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
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

Joined: Jan 10, 2002
Posts: 56554
    
  14

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

Joined: Feb 27, 2002
Posts: 8876

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: more than one in bean in jsp page
 
Similar Threads
Question ID :997810765481
Is this answer right?
JSP:Include question
jsp:useBean
FormBean value on jsp page