Skip to main content

Posts

Showing posts with the label JEE

Java: On login trigger code run after login

Ok so from the title you can see I am hanging around the database for way to long. I needed to have some code executed when I logged on so this is what I did: I threw together a quick HttpSessionListener like such: package za.co.test.web.faces.listener; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class LoginSessionListener implements HttpSessionListener {  @Override  public void sessionCreated(HttpSessionEvent event) {  doSomeStuff();  } @Override public void sessionDestroyed(HttpSessionEvent event) { // do nothing } } Then added the listener to my web.xml. <listener> <listener-class>za.co.test.web.faces.listener.LoginSessionListener</listener-class> </listener> All working and sorted.

JDeveloper: JEE Web Application

I had to throw together a quick demo of the JDeveloper JEE functionality and was pleasantly surprised what Jdeveloper give you for free. Will be posting some of what I have found. Create a New JEE Web Application and press OK button Fill in your info here  replacing ProjectName with your project Name: App Package prefix: eg: za.co.test Next * 5 Finish Now on to creating an EJB Entity: Select Entities from Tables and click ok As we are creating the first ejb in the app you can click next on the persistance unit screen. I am going to select the  countries and regions tables from the HR schema by selecting them and clicking the blue arrow after querying all the tables. Next. Next Select Discover foriegn keys dynamically. Next * 3 but take note of the info in the screens. (You can change the class and package names etc) Finish Now take note of the java classes created complete with annotaions and relationships very nifty. ...