You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Barry Volpe <st...@childrencare.com> on 2003/09/18 21:26:41 UTC
Simple Tiles Controller not working!
Trying to implement example from:
http://www.theserverside.com/resources/articles/Tiles101/article.html
Getting the following error:
************** Exception in:/tiles/penguinview.jsp] null **************
Basically trying to put a hashtable in request and tiles context cannot display in
jsp:
public class LoadUserCategoriesController extends Action implements Controller{
public void perform(ComponentContext tilesContext,
HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext)throws ServletException, IOException{
Hashtable penguins = new Hashtable(20);
penguins.put("name","Name");
penguins.put("price","Price");
request.setAttribute("penguinOfTheDay", penguins);
tilesContext.putAttribute("penguinOfTheDay", penguins);
}
}
In tiles-def.xml
<definition name=".penguin.view"
path="/tiles/penguinview.jsp"
controllerClass ="com.childrencare.LoadUserCategoriesController"/>
In penguinview.jsp:
<c:out value="${penguinOfTheDay.name}"/>
In myjsp:
<tiles:insert definition=".penguin.view" flush="true" />
If I remove the controllerClass in the definiton the page does not return null Exception (no error);
Looks like controllerClass is not getting called or I am not passing the correct object?
Thanks,
Barry