You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Karan Malhi <ka...@gmail.com> on 2008/07/14 19:53:22 UTC

Injection Support for JSF 1.2 Managed Beans

Finished adding injection support in JSF managed beans. Currently, I have
only tested it with tomcat 6.x and Sun JSF RI v 1.2 (Mojarra).
Thanks DBlevins for very patiently answering all of my questions on IRC.

Any feedback is welcome. If you want to try other combinations like
icefaces, ajax4jsf, richfaces, myfaces, etc also, then that would really be
nice.  Other versions of tomcat would also be interesting to get feedback on
(v 5.5 )

How do you test it:-
1. Add jsf-api.jar, jsf-impl.jar and jstl-1.2.jar to <<tomcat-install>>/lib
2. Create a web-app
3. Create a EJB inside the web-app
4. Create a JSF managedbean and using annotations inject the EJB into a
field/property  etc. Make sure to provide the jndi name in the annotation
5. create a JSP and use the managed bean
6. send a request to the JSP

If you can perform step 1, and then just need a web-app to play with, then
you can download it from http://people.apache.org/~kmalhi/dummy.war
The src directory in the above war contains the source code.
Once you drop the dummy.war inside <<TOMCAT_INSTALL>>/webapps, you can then
test it at
http://localhost:8080/dummy/index.faces

If you can add two numbers and can also see a greeting on the last line,
that means it works.
-- 
Karan Singh Malhi

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Dain Sundstrom <da...@iq80.com>.
Very cool.

-dain

On Jul 14, 2008, at 10:53 AM, Karan Malhi wrote:

> Finished adding injection support in JSF managed beans. Currently, I  
> have
> only tested it with tomcat 6.x and Sun JSF RI v 1.2 (Mojarra).
> Thanks DBlevins for very patiently answering all of my questions on  
> IRC.
>
> Any feedback is welcome. If you want to try other combinations like
> icefaces, ajax4jsf, richfaces, myfaces, etc also, then that would  
> really be
> nice.  Other versions of tomcat would also be interesting to get  
> feedback on
> (v 5.5 )
>
> How do you test it:-
> 1. Add jsf-api.jar, jsf-impl.jar and jstl-1.2.jar to <<tomcat- 
> install>>/lib
> 2. Create a web-app
> 3. Create a EJB inside the web-app
> 4. Create a JSF managedbean and using annotations inject the EJB  
> into a
> field/property  etc. Make sure to provide the jndi name in the  
> annotation
> 5. create a JSP and use the managed bean
> 6. send a request to the JSP
>
> If you can perform step 1, and then just need a web-app to play  
> with, then
> you can download it from http://people.apache.org/~kmalhi/dummy.war
> The src directory in the above war contains the source code.
> Once you drop the dummy.war inside <<TOMCAT_INSTALL>>/webapps, you  
> can then
> test it at
> http://localhost:8080/dummy/index.faces
>
> If you can add two numbers and can also see a greeting on the last  
> line,
> that means it works.
> -- 
> Karan Singh Malhi


Re: Injection Support for JSF 1.2 Managed Beans

Posted by David Blevins <da...@visi.com>.
Excellent work!

-David

On Jul 14, 2008, at 10:53 AM, Karan Malhi wrote:

> Finished adding injection support in JSF managed beans. Currently, I  
> have
> only tested it with tomcat 6.x and Sun JSF RI v 1.2 (Mojarra).
> Thanks DBlevins for very patiently answering all of my questions on  
> IRC.
>
> Any feedback is welcome. If you want to try other combinations like
> icefaces, ajax4jsf, richfaces, myfaces, etc also, then that would  
> really be
> nice.  Other versions of tomcat would also be interesting to get  
> feedback on
> (v 5.5 )
>
> How do you test it:-
> 1. Add jsf-api.jar, jsf-impl.jar and jstl-1.2.jar to <<tomcat- 
> install>>/lib
> 2. Create a web-app
> 3. Create a EJB inside the web-app
> 4. Create a JSF managedbean and using annotations inject the EJB  
> into a
> field/property  etc. Make sure to provide the jndi name in the  
> annotation
> 5. create a JSP and use the managed bean
> 6. send a request to the JSP
>
> If you can perform step 1, and then just need a web-app to play  
> with, then
> you can download it from http://people.apache.org/~kmalhi/dummy.war
> The src directory in the above war contains the source code.
> Once you drop the dummy.war inside <<TOMCAT_INSTALL>>/webapps, you  
> can then
> test it at
> http://localhost:8080/dummy/index.faces
>
> If you can add two numbers and can also see a greeting on the last  
> line,
> that means it works.
> -- 
> Karan Singh Malhi


Re: Injection Support for JSF 1.2 Managed Beans

Posted by Karan Malhi <ka...@gmail.com>.
Forgot one step, make sure to deploy in the latest openejb-tomcat-webapp.war
inside the <<TOMCAT_INSTALL>>/webapp first

On Mon, Jul 14, 2008 at 1:53 PM, Karan Malhi <ka...@gmail.com> wrote:

> Finished adding injection support in JSF managed beans. Currently, I have
> only tested it with tomcat 6.x and Sun JSF RI v 1.2 (Mojarra).
> Thanks DBlevins for very patiently answering all of my questions on IRC.
>
> Any feedback is welcome. If you want to try other combinations like
> icefaces, ajax4jsf, richfaces, myfaces, etc also, then that would really be
> nice.  Other versions of tomcat would also be interesting to get feedback on
> (v 5.5 )
>
> How do you test it:-
> 1. Add jsf-api.jar, jsf-impl.jar and jstl-1.2.jar to <<tomcat-install>>/lib
>
> 2. Create a web-app
> 3. Create a EJB inside the web-app
> 4. Create a JSF managedbean and using annotations inject the EJB into a
> field/property  etc. Make sure to provide the jndi name in the annotation
> 5. create a JSP and use the managed bean
> 6. send a request to the JSP
>
> If you can perform step 1, and then just need a web-app to play with, then
> you can download it from http://people.apache.org/~kmalhi/dummy.war<http://people.apache.org/%7Ekmalhi/dummy.war>
> The src directory in the above war contains the source code.
> Once you drop the dummy.war inside <<TOMCAT_INSTALL>>/webapps, you can then
> test it at
> http://localhost:8080/dummy/index.faces
>
> If you can add two numbers and can also see a greeting on the last line,
> that means it works.
> --
> Karan Singh Malhi




-- 
Karan Singh Malhi

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Karan Malhi <ka...@gmail.com>.
>
> Will the change work with these jsf jars in WEB-INF/lib? Is copying to
> the server-wide directory required?
>

Yes, now the change works with jsf jars in WEB-INF/lib. Copying to
server-wide directory is not required anymore.
-- 
Karan Singh Malhi

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Karan Malhi <ka...@gmail.com>.
  Does JSF RI work if you put stuff in
> > the WEB-INF lib (I am talking about a regular JSF webapp here -- without
> > installing openejb-tomcat-webapp.war)
>
> Yes, it does. JSF is just another (web) application framework so
> WEB-INF/lib is the preferred place.
>
>
Duh! . Can I use lack of sleep as an excuse for my comment about JSF RI
earlier ;) .


>  --
> Karan Singh Malhi
>

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Tue, Jul 15, 2008 at 5:45 PM, Karan Malhi <ka...@gmail.com> wrote:

> This is probably a question for one of the D's to answer ;) . I have not
> tested with the jars in the WEB-INF/lib, but my guess would be that it may
> not work with the jars in the WEB-INF/lib (this may be more of a JSF RI
> thing than an openejb tomcat thing). Does JSF RI work if you put stuff in
> the WEB-INF lib (I am talking about a regular JSF webapp here -- without
> installing openejb-tomcat-webapp.war)

Yes, it does. JSF is just another (web) application framework so
WEB-INF/lib is the preferred place. When in the full-blown application
server like Geronimo no JSF libs are necessary (they should even be
ignored).

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Karan Malhi <ka...@gmail.com>.
>
>
> Will the change work with these jsf jars in WEB-INF/lib? Is copying to
> the server-wide directory required?
>
This is probably a question for one of the D's to answer ;) . I have not
tested with the jars in the WEB-INF/lib, but my guess would be that it may
not work with the jars in the WEB-INF/lib (this may be more of a JSF RI
thing than an openejb tomcat thing). Does JSF RI work if you put stuff in
the WEB-INF lib (I am talking about a regular JSF webapp here -- without
installing openejb-tomcat-webapp.war)

> --
> Karan Singh Malhi

Re: Injection Support for JSF 1.2 Managed Beans

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Mon, Jul 14, 2008 at 7:53 PM, Karan Malhi <ka...@gmail.com> wrote:

> Finished adding injection support in JSF managed beans. Currently, I have only tested it with tomcat 6.x and Sun JSF RI v 1.2 (Mojarra).

Nice!

> 1. Add jsf-api.jar, jsf-impl.jar and jstl-1.2.jar to <<tomcat-install>>/lib

Will the change work with these jsf jars in WEB-INF/lib? Is copying to
the server-wide directory required?

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl