You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manuel Riche <ma...@thales-is.com> on 2002/03/21 10:59:48 UTC

How to display a static file in a body tile

I use the taglib tiles and i want display a static file (an html file
with pictures)  with an absolute URL in a body's tile.
Is it possible and how can i do that ?

Thanks


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to display a static file in a body tile

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  <bean:include ...> "perform an internal dispatch to the specified application
component (or external URL) and make the response data from that request available as a
bean of type String. " (extract from doc).

  So you need to write the bean once you have got it :
  <bean:write name="myHref" />

  Hope this help,
     Cedric

Manuel Riche wrote:

> Thanks for your response, but i allways have a problem.
> I work whith the tiles's tutorial :
>
> myPage.jsp =
>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
>
> <tiles:insert page="/themes/myPageLayout.jsp">
>   <tiles:put name="title"  value="--TEST--" />
>   <tiles:put name="header" value="/themes/myHeader.jsp" />
>   <tiles:put name="footer" value="/themes/myFooter.jsp" />
>   <tiles:put name="menu"   value="/basic/menu.jsp" />
>   <tiles:put name="body"   value="/basic/myBody.jsp" />
> </tiles:insert>
>
> myBody.jsp =
>
> <%@ taglib uri="/WEB-INF/tiles.tld"       prefix="tiles" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>
> <bean:include id="myHref" href="http://localhost:8080/anOtherApp/data/myFic.html"
> />
>
> the result is
>
> [ServletException in:/basic/myBody.jsp] Exception reading resource
> http://localhost:8080/anOtherApp/data/myFic.html: java.net.ConnectException:
> Connection refused: no further information'
>
> I put myFic.html in /tutorial/data and i modify myBody.jsp =
>
> <%@ taglib uri="/WEB-INF/tiles.tld"       prefix="tiles" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>
> <bean:include id="myPage" href="http://localhost:8080/tutorial/data/f_ntcd.html" />
>
> i haven't error but the page isn't displayed
> i have the same result with
> <bean:include id="myPage" page="/data/myFic.html" />
>
> I don't understand why ?
>
> Cedric Dumoulin a écrit :
>
> >   You can use Struts <bean:include href="anUrl" /> inside your body.
> >   If you want to use a value coming from a Tile attribute, do something like :
> >
> >   <tiles:useAttribute name="tileAttributeName" />
> >   <bean:include href="<%=tileAttributeName%>" />
> >
> >   Checks documentation for these tags for more :
> > http://jakarta.apache.org/struts/userGuide/struts-bean.html#include
> > http://www.lifl.fr/~dumoulin/tiles/doc/tilesTags.html#useAttribute
> >
> >    Hope this help,
> >
> >      Cedric
> >
> > Manuel Riche wrote:
> >
> > > I use the taglib tiles and i want display a static file (an html file
> > > with pictures)  with an absolute URL in a body's tile.
> > > Is it possible and how can i do that ?
> > >
> > > Thanks
> > >
> > > --
> > > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to display a static file in a body tile

Posted by Manuel Riche <ma...@thales-is.com>.
Thanks for your response, but i allways have a problem.
I work whith the tiles's tutorial :

myPage.jsp =

<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>

<tiles:insert page="/themes/myPageLayout.jsp">
  <tiles:put name="title"  value="--TEST--" />
  <tiles:put name="header" value="/themes/myHeader.jsp" />
  <tiles:put name="footer" value="/themes/myFooter.jsp" />
  <tiles:put name="menu"   value="/basic/menu.jsp" />
  <tiles:put name="body"   value="/basic/myBody.jsp" />
</tiles:insert>

myBody.jsp =

<%@ taglib uri="/WEB-INF/tiles.tld"       prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<bean:include id="myHref" href="http://localhost:8080/anOtherApp/data/myFic.html"
/>

the result is

[ServletException in:/basic/myBody.jsp] Exception reading resource
http://localhost:8080/anOtherApp/data/myFic.html: java.net.ConnectException:
Connection refused: no further information'

I put myFic.html in /tutorial/data and i modify myBody.jsp =

<%@ taglib uri="/WEB-INF/tiles.tld"       prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<bean:include id="myPage" href="http://localhost:8080/tutorial/data/f_ntcd.html" />

i haven't error but the page isn't displayed
i have the same result with
<bean:include id="myPage" page="/data/myFic.html" />

I don't understand why ?

Cedric Dumoulin a écrit :

>   You can use Struts <bean:include href="anUrl" /> inside your body.
>   If you want to use a value coming from a Tile attribute, do something like :
>
>   <tiles:useAttribute name="tileAttributeName" />
>   <bean:include href="<%=tileAttributeName%>" />
>
>   Checks documentation for these tags for more :
> http://jakarta.apache.org/struts/userGuide/struts-bean.html#include
> http://www.lifl.fr/~dumoulin/tiles/doc/tilesTags.html#useAttribute
>
>    Hope this help,
>
>      Cedric
>
> Manuel Riche wrote:
>
> > I use the taglib tiles and i want display a static file (an html file
> > with pictures)  with an absolute URL in a body's tile.
> > Is it possible and how can i do that ?
> >
> > Thanks
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to display a static file in a body tile

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  You can use Struts <bean:include href="anUrl" /> inside your body.
  If you want to use a value coming from a Tile attribute, do something like :

  <tiles:useAttribute name="tileAttributeName" />
  <bean:include href="<%=tileAttributeName%>" />

  Checks documentation for these tags for more :
http://jakarta.apache.org/struts/userGuide/struts-bean.html#include
http://www.lifl.fr/~dumoulin/tiles/doc/tilesTags.html#useAttribute

   Hope this help,

     Cedric

Manuel Riche wrote:

> I use the taglib tiles and i want display a static file (an html file
> with pictures)  with an absolute URL in a body's tile.
> Is it possible and how can i do that ?
>
> Thanks
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>