Java Virtal Machine.net

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

April/2024
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
212223242526 27
282930    

[ Archives News
for 'Java Technology' ]

home > news > java technology > context and dependency injection (jsr 299) and servlets

Context And Dependency Injection (JSR 299) And Servlets

I've had questions about how to inject Web Beans into servlets and whether that is supported.  In this entry I'll outline a method of accomplishing just that. This is a simple login application that communicates to a servlet using Ajax calls from a JSP view.  I'm not going to focus on the view or the protocol (Ajax) that  is used to communicate with the servlet.  If you are interested in that, you can check out the source (instructions at the end of this post).  I'm going to focus on the servlet code and the supporting classes for the application.  The application just prompts for a user name / pasword, and pressing the submit button sends those values to a servlet.  First, let's take a look at some of the supporting code for the application: Listing 1: Login Credentials package webbeansservlet;   import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Default; import javax.inject.Named;   /**  * This is just a simple container class Web Bean for the username  *  and password entry values.  */ @Named @RequestScoped @Default public class Credentials { ...


Date: September, 09 2009
Url: http://www.java.net/blog/rogerk/archive/2009/09/09/context-and-dependency-injection-jsr-299-and-servlets


Others News

©2002-2019Java-Virtual-Machine.net https://mobirise.com/ | mobirise builder | best website maker | css slider | free bootstrap templates