struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sgarlata Matt" <sgarlata_m...@bah.com>
Subject Re: Compartmentalization of Modules (was Re: [18111] et al)
Date Thu, 22 Jan 2004 21:31:19 GMT
Comments below...
----- Original Message ----- 
From: "James Mitchell" <jmitchell@apache.org>
To: "Struts Developers List" <struts-dev@jakarta.apache.org>
Sent: Thursday, January 22, 2004 4:18 PM
Subject: Re: Compartmentalization of Modules (was Re: [18111] et al)


> > <html:link module="exercise" action="welcome" />
>
> I don't think that's the best idea.  Doing that means your pages know they
> are in a particular module.

I disagree that this means pages know that they are in a particular module.
Continuing with the previous example, if I put

<html:link module="exercise" action="welcome" />

in my JSP, that means that I know there is a module called exercise with an
action called welcome.  However, I should be able to put that same link in a
JSP that is in the default module or any module and it will still work.  I
don't see a problem with this proposed change to the <html:link> tag.

> If I were to begin using them again, I like the
> idea of being able to use (dare I say 'share') a single jsp in several
> different Modules.

Definitely.  I do this all the time.

> So you'll get a different looking (and acting) page but
> you don't have to copy the jsp into that modules folder.  It simply
renders
> the images, css, scripts, etc, etc for the Module that it happens to be
used
> in.  Does that make sense?

Yep, that makes sense.  What I do now is I have a 'common' folder directly
off the webapp root where I put JSPs that are used by multiple different
modules.  (My 'common' folder is not a proper Struts module, just a folder
for me to put in common JSPs.)  Of course this solution can be generalized
to use any folder name.  Now the problem with this approach is that
referencing a JSP in the common folder is a little different when coming
from the default module or from some other module.  For example...

default module:
<jsp:include page="common/commonpage1.jsp"/>

other modules:
<jsp:include page="../common/commonpage1.jsp"/>

My solution to this problem is basically that I don't use the default module
for much of anything.  My current thinking is that it's good to initialize
plugins and to use for the login and logoff actions, and that's it.  Another
solution is to write a custom tag (which I have done) that will translate
URLs for you automatically.  I do something like this:

<krm:url>common/commonpage1.jsp</krm:url>

which will always translate to common/commonpage1.jsp (the tag just takes
its body contents and prepends http://ip_address/webapp_name/)

Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message