Tomcat and Servlets

Dennis devel at muhlesteins.com
Tue Mar 21 09:03:09 MST 2006


Ross Werner wrote:
> My apologies everyone. (For once) I didn't mean to start a flamewar! :)
>
> On Mon, 20 Mar 2006 11:46:05 -0800, Bryan Sant <bryan.sant at gmail.com>
> wrote:
>> On 3/20/06, Dennis <devel at muhlesteins.com> wrote:
>>> in my book by simply reloading the page.  I've developed with
>>> Struts/Tiles, written my own framework, experimented with Spring,
>>> Hibernate and pretty much every other framework available ( Tapestry
>>> and
>>> the likes).   The simple stats are that for small projects, Java takes
>>> longer to develop other frameworks (With the best IDE too)
>>
>> Eclipse compiles as you type.  There is no wait.  If you're building
>> web applications, and you're using JSP, then you don't have to
>> re-compile either.  Just save your .jsp file and hit "reload" in your
>> browser -- done.  It is no different than working with a dynamic lang.
>
> This is the sort of thing I'm thinking about. If you're *not* using
> JSPs, you don't get this automatic recompile when you hit "reload".
> Why not? It doesn't seem like there should be any reason against it
> for development. Change one line in my servlet .java file, reload the
> page, and that's it! It *could* be done--so why isn't it? Is there a
> good reason? Is it possible for [me?] to create something that does do
> this? These are the sorts of questions I'm trying to answer. :)
>
> As soon as I get a bit more done I'll post what I have for
> (constructive) criticism.
Here are a few things I've developed.  If interested, I could share some
code:
1) Struts/Jsp i18n tags cause you to rebuild/reload.  We found this a
HUGE drawback when creating a site that used japanese & english.  I
developed a little tag that reads an property file or embedded block and
chooses the correct locale message.
2) Struts form beans and validation require TONS of lines of xml,
rebuilding and reloading.  (I've used dyna-beans, dyna-validator forms
the Struts-Console for the xml and all that... it still sucks.)  I
developed a few simple jsp tags that mimic the behavior but are run in
the jsp.
3) Struts Actions, Spring Beans/actions, and pretty much ever other
controller require lots of XML, rebuilding and reloading.  I still have
struts as the controller because of some legacy code, but I create an
action like this:
  <action path="/**Script"
                        parameter="/WEB-INF/bsh/struts/{1}.bsh"
                        type="[the script action that runs the script">
                        <forward name="success"
                                 path="/{1}.jsp"
                                 redirect="false"
                                 contextRelative="true"/>
This way I simply add a new bsh file to my directory and I instantly
have a new action w/ a forward.  I largely don't have to deal with
struts any longer.  If I didn't have the legacy code, I could probably
wipe struts out and map an action to run the scripts in the web.xml
4) For AJAX, I use http://getahead.ltd.uk/dwr/  You'll see in the latest
release that I contributed a few patches to make remote scripts
reloadable.  I can use bsh for those too.

The process is far from complete.. I still have code (like Hibernate for
ORM) that has to be built and reloaded when changed but I've tried to
use that in places that don't change as often.  As painful as modifying
db structure is (see previous post) It's not done as often and I can
live with it until something better comes along I guess.

-Dennis
>
>     ~ Ross
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */




More information about the PLUG mailing list