Question: I am working on a web application that is used to print user receipts based on the supplied receipt number. I want to enhance it in such a way that when i supply receipt numbers from 1 to 100 it will print all 100 receipts. Is there any ways in Java to implement this. How can i implement this in Java ?

Answer: 
Good frameworks give you a ready solution to common problems. Reinventing solutions for yourself probably will be excessive work. As a learning exercise coming up with stuff for yourslef has some value. To get a real job done efficiently use a framework. 

This does assume that good frameworks exist in your world ...
There are already some good answers to "which framework" question for PHP on StackOverflow, so I won't go into those.

However, as far as libraries go I would recommend using the [ADODB library](http://adodb.sourceforge.net/) (easier proper sanitisation of input, supports multiple DB's, better API than PHP's native DB specific classes) and writing a few classes of your own.

A good example of a "lite" framework that provides templating (and that is also a good example of a well written framework) is [Smarty](http://www.smarty.net/) (which is used by the W3C on their website - not a bad endorsement). To some it seems redundant to have a templating language in PHP, but it does help enforce a notable degree of separation of presentation logic vs application logic.

I think it's best steer clear of frameworks on PHP until you see something that really meets a need you can't solve easily without it.

My take on it is that you are happy writing your own classes and small site specific frameworks you'll be better able to evaluate other frameworks more easily (I regard this as a unique challenge with PHP as there is a bit of over supply of crummy frameworks that gets in the way of finding the good ones).