After looking for solution and experimenting a lot with my code i finally found the solution. As you can see in my index.jsp code i have written category.id_cat.
<a href="category?${category.id_cat}">
One should be very careful while using netbeans wizard to create entiy class. My column name in table "category" is id_cat which changes to idCat in Category.java class. Though i thought its accepts the same name id_cat as mentioned in the Category.java class using annotation
@Column(name="id_cat")
but i didnot see the variable declare just below,i.e.
private Short idCat
now to fetch the value i have to access idCat not id_cat. I replaced the code <a href="category?${category.id_cat}">
with <a href="category?${category}">
to see what column and values is being set in category variable from ${categories} result. I then found its using idCat=1 and then i went back to my code and found the variable in which the id_cat value from table was initialized. It was using idCat variable as i have mentioned above. I replaced id_cat with idCat and now its working perfectly.