JSP is ultimately going to be converted into servlet by JSP engine....Can I use JSP as a controller in MVC Architecture(using JavaBean as Model, as I can use useBean tag to refer Model in JSP).. If so, How can I define doPost() or doGet() or service() method in JSP & then why Servlet is preferred over JSP for the same.... Can I define my own methods in JSP? Can Global Variable be defined in JSP?, If so or not, why?
While no one will come to your office to break your kneecaps if you do, this is generally not considered a good pattern to follow. Do yourself a favor and become familiar with what is known as the 'Model 2 Pattern' where servlets serve the purpose of controllers, and JSPs are used to render views.
How can I define doPost() or doGet() or service() method in JSP
As Jeffrey pointed out, you don't.
why Servlet is preferred over JSP for the same
There are countless articles all over the web on why the Model 2 pattern is preferred. Do a bit of searching and all will be revealed.
Can I define my own methods in JSP?
Yes, but again, don't. There are now much better mechanisms such as the JSTL and custom actions to add functionality to your JSPs.
Can Global Variable be defined in JSP?
Depends what you mean by 'global'. If you mean class-level members, then yes. But be very very careful. It is very easy to make your JSPs non-thread-safe when doing so. My advice: don't.
In fact, my general advice when it comes to JSPs is: write your JSPs with no Java in them. None. Zero. Zilch. Nada. With today's level of JSP and Servlet technology, your JSPs should contain markup, JSP actions and directives, JSTL actions and custom actions. Scriplets and scriplet expressions should either be relegated to the past, or used only as a last resort (and since adopting scriptless pages, I have yet to come up against such a 'last resort' scenario). [ July 22, 2004: Message edited by: Bear Bibeault ]
JSP's were created in order to provide servlet functionality where the majority of the work was involved in producting presentation. I've seen systems where a JSP incorporated business logic and dispatched to a separaet JSP for presentation, and I blush to admit that I've created JSPs that were moe Java code than markup (any they were VERY ugly). That, however, was a long time agot where saber-toothed tigers still prowled the Earth and the resources available for J2EE development were considerably less refined.
As a rule, the logic should be in servlets and the markup should be in JSPs. Although JSP-capable page editors tend to be neither common nor cheap, you ability to edit and maintain JSPs regardless of the tool used drops rapidly as you add Java code to them. The clash of syntaxes causes everything from poor editor performance (Emacs basically hists a wall everytime your cursor in or out of scriptlet code) to outright failure.
Model 2 is the name given in the J2EE world to the popular attempt to mimic how MVC works in the constricted world of HTTP. Probably the most famous implementation of Model 2 is Struts.
However, Struts may end up being supplanted by JSF in the long term - JSF is designed to permit componentized "drag and drop" design. But JSF is still a new product and I'm not sure how much I like it yet.
An IDE is no substitute for an Intelligent Developer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com