• 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

how to write a bean class?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends
HFSJ book says that if "type" is used without "class" ,the bean must already exist.My doubt is how to write a bean class code,so that bean is already stored as an attribute at the scope and with the "id" we have put in <jsp:useBean> tag.
anybody let me know please

thanks in advance
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Write a standard JavaBean, put it in /WEB-INF/classes, and then in your JSP page, when using the <jsp:useBean> tag provide the full path of the class or import it using a page directive.

As an example, if the JavaBean was written in a package named beans, you have to say :



Or,



Make sure that your bean must have a public no-arg constructor.

Best of luck ...
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your Servlet create the bean and place it into whatever scope you choose with the id you want to use
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic