Forums Register Login

@ManagedBean Annotation JSF2

+Pie Number of slices to send: Send
I am from a Seam/JSF1 Environment. I configured my Bean using annotation but could not access the class from my JSP page
the class i defined is as follows

+Pie Number of slices to send: Send
Well, part of your problem is that you don't access a class from a JSF View (what you called a "JSP"). You access an instance of a class.

Specifically, when you use the annotations that you illustrated, the JSF framework is going to instantiate a bean of class "Ab" and store it in your webapp's HttpSession object under the name "ab", since by default, the convention is to lower-case the class name's first character to form the instance name. That can be overridden with an annotation, but it's a reasonable naming convention.

So to refer to your bean's properties in a JSF view, you'd use the EL expression "#{ab.name}".
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4344 times.
Similar Threads
Injection problem - not quite sure if this is something i should be using injection for
Issue with JPS and refreshing Entity bean's data.
Annotations Not Working
Spring 2.5.6 bean annotation validation
JSF 2.0 Dependency injection problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:53:12.