On Friday 13 February 2004 18:10, Andy Engle wrote:
> Hi all,

Hi Andy,

> I'm working with a web application in which I have multiple pages of
> information, currently located in PHP files.  I want to convert these
> PHP files into JSPs, and then make them available to be directly
> called within my web application. I would like to have these JSPs
> available for direct access because I want to make it easy for users
> of this application to bookmarks whatever pages they're interested in
> going back to from time to time.

Well, you can bookmark Struts actions as well. Generally, I consider
direct calls to JSP pages a bad design. It's better to wrap such
pages into an Action (you can use the standard ForwardAction,
just a single line in struts-config.xml) and change the links to
calling that instead of the 'real' page behind it. The advantage
of this approach is that - though it might seem to be a little
more work at the beginning - you have everything centralized.
That means: one single point of handling security issues if
needed, and if you want to change the application structure
later (which will inevitably be the case one day, and that
day is *always* nearer than one thinks it is) or just want
to replace some files, port everything to Tiles (recommendable)
or whatever, you only have to deal with struts-config.xml
and tiles-defs.xml, possibly, but not with hundreds of links
in each and every file.  

> Each page will have a form, which 
> will be submitted to a Struts action when submitted, and then from
> there I want the action to update the database, then return the same,
> updated JSP to the user.

So you set up a standard ForwardAction that forwards to
your JSP; if you want to pre-populate some fields, write
a small custom Action that creates the form bean and
puts it into the appropriate scope before forwarding, and
that's it.

> I'm wondering if making JSPs available to the user in this manner is
> a poor practice, and if so, what would be a better way of doing it?
> Furthermore, will I run into any problems with the Struts custom tags
> or tiles by taking this approach?

See above. In particular when thinking about Tiles,
use Action references in your links from the very
beginning. Then, you can gradually port your
site to Tiles step-by-step (replacing the Action
targets by Tiles definitions, while the JSPs still
call the Actions and can't tell whether the target
is a normal JSP page or a Tiles definition), and
it will still work as usual during the entire 
migration process.

> Thanks very much for sharing your thoughts.
>
>
> Andy

HTH,
-- Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to