This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

bean name  RSS feed

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we have same bean name in different scopes like person named bean in request and page scopes?

thanks

Harish
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can have beans stored in different scopes with the same name.
 
Harish Yerneni
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got bean name duplicate error when I tried

<jsp:useBean id="person" class="foo.Person" scope="page"></jsp:useBean>
Dog's name is: <jsp:setProperty name="person" property="name" value="harish" />
Dog's name is: <jsp:getProperty name="person" property="name" />

<jsp:useBean id="person" class="foo.Person" scope="request"></jsp:useBean>
Dog's name is: <jsp:setProperty name="person" property="name" value="harish" />
Dog's name is: <jsp:getProperty name="person" property="name" />
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot give the same id to different beans.
Change "person" to something else, it has to be unique.
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Satou is correct.

Your original question is regarding having beans in different scopes with the same name. That is possible.

It's not possible to have two beans with the same id on the same page.
 
permaculture is largely about replacing oil with people. And one tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!