Kyle Gabhart wrote:
Robert Van Overmeiren wrote:

I know that the Java pros believe in keeping Java out of JSP, and do so
by using taglibs and beans.

The only real custom programming in my Magnolia-based site right now is
a pharmacy lookup script. To try to adhear to the taglib approach to
doing things, I utilize the SQL taglib, but fall back to using
scriptlets to capture form data, build a 'where clause', insert the
clause into the SQL string, and fix any number signs in the address so I
can get a map.

I know this isn't Magnolia, but with the holidays coming, perhaps
someone is feeling generous.

Is it possible to avoid using scriptlets in these situations completely?

Is it worth the trouble to build a class or bean or prepared statement
for such a simple little process?

How offensive is this mixture of methods to the pros with their OOP &
MVC & API's & frameworks?

I'm not asking anyone to build me a bean, but just a little direction.

Before anyone starts yelling "make your own taglibs!", I just want to mention a couple of good tips:

There is nothing wrong with making something that works.

(Yes, even if it includes sql-queries and scriptlets in the JSPs)

However, if you find yourself repeating the process, feeling that you are leaving lots of cluttered work behind for your colleagues and yourself at a later time, use the time needed to tidy it up. Some people think you should tidy up before you start coding, but I find code-first, tidy-later to be better. Easier learning curve.

Kyle is right about keeping the SQL away from your JSP. Rather invoke a DAO-object (see http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html). If you manage this pattern you are ready for using Hibernate, I would say.

Use servlets instead of JSPs for pages that do not display anything in particular. Make servlets like StoreMyStuffServlet, actions that handles business logic and data-access.

If your JSP still is very cluttered, start making your own taglibs!! :D

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to