My approach to externalizing image paths was to extend
org.apache.struts.taglib.html.ImgTag and use a custom tag to define image
URL's using the existing pieces ImgTag provides.   Overriding src() is used
to look up the look up the image URL base path from a properties file.

I've similarly created a custom tag that outputs the image URL as a string,
so that it can be used in JavaScript or in other ways if necessary, and it
relies on a common utility method to retrieve the image URL path that is
shared with the ImgTag subclassed tag.

    Erik


----- Original Message -----
From: "Matt Raible" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 12:33 PM
Subject: Re: bean:define, bean:write


> I don't think there's such a thing as <jsp:define> is there?
>
> I have a similar question - I'd like to use <bean:define> at the top of my
> page, but it is not used if one already exists...
>
> What I'm trying to do is set a path to all my images that lives on the
> webserver.  I'd like to externalize this value into the web.xml - is this
> possible.  If so, how do I retrieve it in my page.
>
> Currently, I'm doing this:
>
> <%
> String imagePath = "/blah/image";
> %>
> image path is <%=imagePath%>
>
> I was thinking of using bean:define to get rid of the scriptlet, but now
I'm
> thinking it would be better to put in a config file.
>
> Also, I've used my ApplicationResource.properties as a place to store
default
> values for populating a form - does anyone recommend a better way?
>
> Thanks,
>
> Matt
> --- Keith Bacon <[EMAIL PROTECTED]> wrote:
> > My guess is that jsp:define creates it if not there
> > but struts bean:define doesn't.
> >
> >
> > --- David Corbin <[EMAIL PROTECTED]> wrote:
> > > I thought that bean:define takes care of that....
> > > ----- Original Message -----
> > > From: "Keith Bacon" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Thursday, September 06, 2001 11:18 AM
> > > Subject: Re: bean:define, bean:write
> > >
> > >
> > > > Is it because you haven't done a
> > > >
> > > > request.putAttribute("pageTitle", yourObject);
> > > >
> > > > in your ActionForm?
> > > >
> > > > Keith.
> > > >
> > > >
> > > > --- David Corbin <[EMAIL PROTECTED]> wrote:
> > > > > Why does this jsp fragment generate an exception
> > > > >
> > > > > javax.servlet.jsp.JspException: Cannot find bean pageTitle in
> > > scope
> > > > > request
> > > > >
> > > > > --cut--
> > > > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > > > > <bean:define id="pageTitle" value="foobar" scope="request"/>
> > > > >
> > > > > <HTML>
> > > > >     <HEAD>
> > > > >          <TITLE><bean:write name="pageTitle"
> > > > > scope="request"/></TITLE>
> > > > >     </HEAD>
> > > > > . . .
> > > > >
> > > > > --cut--
> > > > >
> > > > > Thanks
> > > > > David Corbin
> > > > >
> > > >
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Get email alerts & NEW webcam video instant messaging with Yahoo!
> > > Messenger
> > > > http://im.yahoo.com
> > > >
> > > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email alerts & NEW webcam video instant messaging with Yahoo!
Messenger
> > http://im.yahoo.com
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo!
Messenger
> http://im.yahoo.com

Reply via email to