• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

newbi question

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I have created very cool bean and I want to use it in my JSP
I wrote
<jsp:useBean id="myCoolBean" scope="session" class="myPackage.MyBean"/>
NOW comes the question!
How can I use this beans properties to transfer them into other beans properties or even some other external JAVA object?
Concrete example... I want to jsp:UseBean which has some usefull information and then pass this information to DataSource which I am getting out of application nameSpace!
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to JSP forum
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just refer to the variable "myCoolBean" in your java code/scriplets. It's the name of an object of class myPackage.MyBean that the servlet container has instantiated for you. Just use it like you would any other object variable.
Ie,
myCoolBean.setSomeProperty(value);
String value = myCoolBean.getSomePropertyValue();
otherObject.invokeSomeMethodThatTakesAmyBeanObject(myCoolBean);
etc.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also see examples in Marty Hall's "Core Servlets and JSP" It's available online at www.coreservlets.com
 
Janis Olex
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou very much!
 
reply
    Bookmark Topic Watch Topic
  • New Topic