Hi Moritz,

Your code looks right to me. What error are you getting?

Another way is to use a JSP .tag file:

/tags/address.jsp:

<%@ tag body-content="scriptless" %>
<%@ attribute name="address" required="true" rtexprvalue="true"
type="com.example.model.Address" %>
<%@ include file="/jsp/taglibs.jsp" %>

<div>${address.street}</div>
<div>${address.city}</div>

/jsp/taglibs.jsp:
<%-- stripes and JSP taglibs... --%
<%@ taglib prefix="yourPrefix" tagdir="/tags" %>

contact.jsp:

<h1>Contact Sheet</h1>
<div>${actionBean.contact.name}</div>
<yourPrefix:address="${actionBean.contact.address}" />

Then you can go ahead and add more .tag files to the /tags directory and
use them with
<yourPrefix:name> where name corresponds to the file name without the
.jsp extension.

Hope that helps.

Cheers,
Freddy
http://www.fdaoud.com

On Tue, Jan 31, 2012, at 10:13 AM, Moritz Petersen wrote:
> Hello everyone,
> 
> maybe I'm missing something, but I have trouble doing the following:
> 
> The idea is to define a piece of reusable JSP code, that can be
> embedded into other JSP pages. I thought it should be quite simple
> with Stripes' layout tags.
> 
> Take an example: in some JSP pages I'd like to display address
> information, so I just want to implement that address view only once.
> 
> contact.jsp:
> 
> ...
> <h1>Contact Sheet</h1>
> <div>${actionBean.contact.name}</div>
> <stripes:layout-render name="/layout/address.jsp"
> address="${actionBean.contact.address}" />
> ...
> 
> address.jsp:
> 
> ...
> <stripes:layout-definition>
>   <div>${address.street}</div>
>   <div>${address.city}</div>
>   ...
> </stripes:layout-definition>
> 
> The idea is, to pass the "address" object to the reusable layout
> component and use it there.
> 
> Is there any way to do this with Stripes? Any other recommendations?
> 
> Thank you & regards,
> Moritz
> 
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
> 

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to