[thelist] How do you build dynamic pages?

Marcus Andersson marcus at bristav.se
Mon May 24 12:44:20 CDT 2004

If I had the possibility to choose I would do the following (more or less):

Use an MVC framework such as Struts. I wouldn't use Struts though. I would go for Webwork(2)[1] (which is 
another MVC framework that is much lighter and easier to use) in conjunction with SiteMesh[2] (which is a 
template framwork that applies the templates on the way out from the server with Servlet Filters). This is a 
very easy to handle solution that allows for easy templating and reuse without the messy struts-config.xml file.

Another nice thing that I love is Velocity[3]. Velocity is an alternative to using JSPs and is much simpler to 
use than JSPs and gives templates that is much easier to read and write (and therefore maintain) and actually 
often performs better than JSP. I would use Velocity instead of JSPs (if I had the choice, that is :)

I would also set up the configuration on the server with something called Spring Framework[4] or 
PicoContainer[5] (these two are much the same, they are called IoC containers). These frameworks are perhaps 
of most use to the engineers.

I can't, unfortunately, help you much about the redirect stuff since those things are usually set up for me by 
other people (but I can understand if static stuff (such as images) isn't served up by Weblogic since it costs 
a lot of $$$).

Another thing, on Weblogic, is that it's extremely expensive if you're only using it as a Servlet container. 
If you are, I would strongly recommend to use a "pure" servlet container. Jetty and Tomcat are free ones and 
Resin is another that isn't free but quite cheap and the one with best performance of all servlet containers 
(Weblogic included). I say this since many companies are actually paying big bucks for Weblogic or Websphere 
and are only using them as servlet containers. Enormous waste of money really... If you are using some form of 
beans (session beans I hope for your sake, the entity ones really suck both from a developer perspective and 
from a performance perspective, use Hibernate[6] instead) and are only using it to serve data to your web app 
I would also strongly advice to get rid of the beans since they make everything a lot more complex and are 
really only necessary when you want to build a truly distributed application (which most people never really 
do, but perhaps you do) or want to have multiple client types (such as both a Swing client and a web client).


[1] http://opensymphony.com/webwork
[2] http://opensymphony.com/sitemesh
[3] http://jakarta.apache.org/velocity
[4] http://springframework.org
[5] http://pico.codehaus.org
[6] http://hibernate.org
Expert One on One J2EE Design and Development, by Rod Johnson, is very good reading on the topic. You find it 
here: http://www.wrox.com/books/0764543857.shtml , where you also find the first chapter as a free one (which 
actually is a good introduction) and you can also find another free excerpt here: 

Tom Dell'Aringa wrote:

> Hi folks,
> Some of you know I'm a big standards proponent, so I build my front
> ends apporpriately. Most things I build at my place of employment end
> up as JSPs. I've worked at various places over the past 10 years and
> seen various ways to build pages on the fly. I'm wondering how you
> all do it and what you think of the process they are using here. I'm
> thinking its not so great - but I'm not and engineer/architect - I'm
> a front end guy.
> We want our pages to be optimized as best we can in all ways -
> including search engines.
> So here it is - please tell me what you think and what you would do
> differently, etc.
> 1. I build the templates for the pages using web standards. A typical
> template will break up into a header, content piece, maybe a sidebar
> and a footer. Let's use that as our example.
> 2. Currently requests for our pages are routed through IIS to an app
> server (WebLogic), which actually handles the requests. I'm told this
> is for security reasons and has something to do with our connection
> pools being shared. I don't get it. What I do know is that this
> necessitates things like:
> - our links having an extra directory on them. Like this:
> www.mydomain/ExtraDir/pages.jsp - which I hate.
> - our home pages are generally ASP pages that are redirected and end
> up being www.mydomain.com/homepage.asp - which is not ideal.
> 3. We build pages with a 'dispatcher.' The engineer sets up a
> database and based on the request URI builds the page dynamically
> from the database. So lets say I request page.jsp. The dispatcher
> would pull globalHeader.html, pageContent.html, pageSidebar.html and
> globalFooter.html and build page.jsp.
> We even do this where pages are totally static - nothing dynamic at
> all on them.
> I've worked at places in the past where we have used Jakarta Struts
> as well. I'm not sure that was any better or not, but I don't think
> anyone here knows Struts. It seemed like a good system, especially
> with MVC theory behind it.
> My concerns are that this *might* be a bad way to build pages (I
> really don't know) and there might be a better/easier way. Also, the
> search engine thing. Any comments are welcome and appreciated.
> Tom
> =====
> http://www.Pixelmech.com/ - read my latest blog posting!
> http://www.crossandthrone.com/ - Eternal Life
> John 3:16

More information about the thelist mailing list