Wednesday, April 24, 2013

Creating a spring project using maven appfuse-basic-spring archetype

In my previous post about using spring security using a users database, I used a sample project which you get when downloading the spring security library. In this post, I will be setting up a spring project using maven appfuse-basic-spring archetype from scratch.

Saturday, April 13, 2013

Spring security using a users database


I’ve started reading about spring, I know the general idea of how it works so I thought I should learn about spring security first. I’ve been reading the “spring security tutorial", which is pretty much straight forward, and there was an exercise of using a users database to authenticate the user. In this post I will be creating the users database and hooking it with spring security. 

Friday, April 12, 2013

Back to blogging


So it’s been a while since my last post. The reason for that is that I've moved to a new country and a new job. I do my current job using a custom built framework built on top of spring, but I don’t even know how does spring work and never interact with that layer. This is bad, most of you think... and your right! I don’t use any widespread technologies, heck, it’s been about a year since I wrote my last servlet! So it occurred to me that since my knowledge about everything else other than my company's framework is shrinking, why don’t I do some studying on my own, read some books, do some practice.

Since we are using spring framework in my company to create the core of the framework that we use to develop applications, I thought its convenient to learn more about spring framework on my own. Although I have been a java developer for about 10 years for now, I've never ever created a project using spring.

My initial purpose of creating  a blog was to have one place where I record all the repetitive gotchas I face during my work so that I can see what I did last time to solve the problem, I do have a bad memory. Then I began writing how-tos for things people might find interesting and useful. Now the blog has been dead for a while and I see that there is traffic coming into the blog, so I thought of writing posts of how I am developing this application, what technologies I am using and for what purpose I am using them. I do plan also to post all researches I do on topics related to what I want to learn.

I will begin posting as soon as I know what type of application I will be writing.

Wednesday, December 14, 2011

Creating a simple frontpage news display - Primefaces

I was working on a project today in which I was requested to create a simple news display in our application's frontpage, so I used the toggleable feature in Primefaces panels and some javascript to achieve this. the result looks like the following:






To do this, I created a request scoped bean which retrieved the news records that I wanted to display in the frontpage

Saturday, December 3, 2011

Refresh image after upload in Primefaces - JSF 2.0

Yesterday I was trying to create a page where the user attach an image to an article and I wanted him to see what image he is attaching before saving the form. I was facing a huge problem which was that the image was only refreshing the first time the user uploads an image, but the second time nothing happens. I am using Primefaces 2.2.


To solve this I did the following:

  1. Stored the image in a session attribute within the fileUploadListener
  2. Retrieved the image inside a servlet and cleared the session attribute
  3. added a javascript within a primefaces outputpanel that changes the image source to the servlet path and added a date parameter to insure that the request will be done everytime this script is run
  4. added an update attribute to the fileupload component which updates the outputpanel created in step 3.

Check the following source for more details

Thursday, November 24, 2011

Creating a database login screen using Primefaces and Hibernate

In this tutorial I will be creating a simple JSF login screen based on a database table. The final result will be a login form in which the user enters his username/password and it will redirect him to the home page or will show him a message indicating an invalid username/password or if his status is inactive.
In order to complete this tutorial you will need to complete those two tutorials, note that you will need to create both projects in the same workspace.

Wednesday, November 23, 2011

An absolute beginner's guide to jQuery - Selectors

In this tutorial I will write about how to include the jQuery library into your page and some basic usages.


  • What is jQuery?
    jQuery is a library of javascript methods that extends native javascript functions to provide an API (application programming interface) that gives its user total control over the DOM (document object model) in a very easy way.