Hello,
I saw examples of runtime composition, but they don't work for me. Maybe
I'm not too smart with JSF yet.
I'm trying to modify tiles definition in a function in managed bean,
for example:
managed bean Foo
public String something() {
//do work
//modify tiles definition
FacesContext ctx = FacesContext.getCurrentInstance();
ctx.responseComplete();
HttpServletRequest request = (HttpServletRequest)
ctx.getExternalContext().
getRequest();
HttpServletResponse response = (HttpServletResponse) ctx.
getExternalContext().getResponse();
TilesContainer container = TilesAccess.getContainer(
request.getSession().getServletContext());
AttributeContext at = container.startContext(request,response);
//modify definition attribute
at.putAttribute("left", new Attribute("/WEB-INF/tiles/new.jsp"));
container.render("myDef", request,response);
container.endContext(request,response);
//forward to jsf page with modified definition with request
dispatcher
//request.getRequestDispatcher("/index.jsp").forward(request,
response);
// or using navigation rule with outcome "ende".
return "ende"
}
With code above I have an empty jsf page - anything the f:view tag is
not rendered.
Could someone point me to the right way with this type of runtime
composition?
Regards,
Jacek