struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thom Burnett" <>
Subject The first request
Date Tue, 05 Dec 2006 19:58:59 GMT
I need to set up my first page with a sequence of database interactions
before the execute() method is called (I think). What's the recommended
struts way of doing so.

When a first request to my jsp page arrives, I need to read some key
parameters of the request, contact my database, and then fill in some fields
of the page based on what the parameters and database tell me. I'm not clear
on how to hook that in. I don't seem to have access to the doPost() and
doGet() methods that I would with a standard servlet.

1. One obvious solution is to extend the struts ActionServlet so that I can
override the doGet() and/or doPost(). Does that interfere with standard
struts behavior?

2. I could also use a standard servlet to handle the request and then
forward or redirect to my struts pages and servlet. That seems to somewhat
defeat the purpose of struts but it could be done.

3. I could also put a lot of java into my jsp page to do all my processing
but that's a violation of MVC and pretty messy as well.

4. I thought about using the constructor of my ActionForm since it gets
called at the right time but I don't have the request object available (and
I need those parameters).

5. Any other ideas?

I need a solution (preferably an example) that works for struts 1.3.5. with
an ActionForm (not the DynaActionForm).

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message