Fahd, I am not sure about class definition class TestTileController extends TilesAction implements Controller .
I guess this has to be public, then only org.apache.struts.tiles.ComponentDefinition can access com.usersmarts.sam.tilescontroller.TestTileController class. Just check your class modifier and test it with public. Reddy Pingili > -----Original Message----- > From: Fahd Ahmed [SMTP:[EMAIL PROTECTED] > Sent: Friday, July 16, 2004 9:57 AM > To: Struts Users Mailing List > Subject: RE: how to use controllerclasses with tiles? > > That doesnt work either. > > The problem comes even if I take out the following lines from header.jsp > > <tiles:importAttribute name="title" scope="page" /> > > and > > <jsp:scriptlet> > System.out.println("ident = " + request.getParameter("title")); > </jsp:scriptlet> > > After eliminating the abovel ines from my header, when I access any jsp > which uses header.jsp, I get the following error. > > [ServletException in:/layouts/threeColumnLayout.jsp] Error - Illegal > class access :Class org.apache.struts.tiles.ComponentDefinition can not > access a > member of class com.usersmarts.sam.tilescontroller.TestTileController > with > modifiers "" > > > -Fahd > > > -----Original Message----- > From: Pingili, Madhupal [mailto:[EMAIL PROTECTED] > Sent: Friday, July 16, 2004 6:29 PM > To: 'Struts Users Mailing List' > Subject: RE: how to use controllerclasses with tiles? > > > Fahd, > Have you tried changing scope="request" in following line > <tiles:importAttribute name="title" scope="page" /> ? > > I am looking at "Struts in Action" book co-authored by Ted Husted, > "<tiles:importAttribute/> tag imports all of the Tiles context attributes > into page context: " . > > So, after this, you can access the attribute named "title" through page > context. > > > Reddy Pingili > > > -----Original Message----- > > From: Fahd Ahmed [SMTP:[EMAIL PROTECTED] > > Sent: Friday, July 16, 2004 3:46 AM > > To: Struts Users Mailing List > > Subject: RE: how to use controllerclasses with tiles? > > > > ok i'll try to explain. > > > > below is the part of my definitions-config file where i declare the > > controller class > > > > <definition name="header" path="/common/header.jsp" controllerClass > > ="com.sam.tilescontroller.TestTileController" > > > <putList name="globalNavigation"> > > <item value="Home" link="/prototype" /> > > </putList> > > </definition> > > > > > > my controller class is as follows > > > > package com.sam.tilescontroller; > > > > import java.util.*; > > import java.lang.*; > > > > import javax.servlet.ServletContext; > > > > import javax.servlet.http.HttpServletRequest; > > import javax.servlet.http.HttpServletResponse; > > > > import org.apache.struts.tiles.Controller; > > import org.apache.struts.tiles.ComponentContext; > > import org.apache.struts.tiles.actions.TilesAction; > > > > > > class TestTileController extends TilesAction implements Controller > > { > > > > public void perform( ComponentContext context, > > HttpServletRequest request, > > HttpServletResponse response, > > ServletContext servletContext) > > { > > try{ > > context.putAttribute("title", "hello from > > controller"); > > }catch(Exception ex) > > { > > System.out.println("Exception in TilesController---" > > + ex); > > } > > } > > } > > > > > > now just this code generates the error no matter i use the value stored > in > > context in my header.jsp or not. but for completion the header.jsp look > > like > > > > <jsp:root > > xmlns:jsp="http://java.sun.com/JSP/Page" > > xmlns:c="http://java.sun.com/jsp/jstl/core" > > xmlns:tiles="http://jakarta.apache.org/struts/tags-tiles" > > xmlns:fn="http://java.sun.com/jsp/jstl/functions" > > version="2.0" > > > > > <tiles:importAttribute name="title" scope="page" /> > > > > <c:url value="/images/safe-logo4.png" var="logoURL"/> > > <table width="100%"> > > <tr> > > <td width="20%" align="left"><img src="${logoURL}" /></td> > > <td width="60%" align="center"><font > > size="4"><b>${title}</b></font></td> > > <td width="20%"> </td> > > </tr> > > <tr> > > <td colspan="3" align="center"> > > <c:if test="${not empty globalNavigation}"> > > <c:forEach items="${globalNavigation}" var="item"> > > <c:url var="link" value="${item.link}" /> > > | <a href="${link}">${item.value}</a> > > </c:forEach> > > | > > </c:if> > > <jsp:scriptlet> > > System.out.println("ident = " + request.getParameter("title")); > > </jsp:scriptlet> > > </td> > > </tr> > > </table> > > </jsp:root> > > > > > > also the web.xml has the following entry > > > > <servlet> > > <servlet-name>Tiles Servlet</servlet-name> > > > <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class> > > <init-param> > > <param-name>definitions-config</param-name> > > > > > <param-value>/WEB-INF/safe-tiles.xml,/WEB-INF/situation-tiles.xml</param-v > > al > > ue> > > </init-param> > > <load-on-startup>2</load-on-startup> > > </servlet> > > > > guess now you may be able to understand and pin point the problem.' > > > > Fahd > > > > > > > > > > -----Original Message----- > > From: Mark Mandel [mailto:[EMAIL PROTECTED] > > Sent: Friday, July 16, 2004 10:38 AM > > To: Struts Users Mailing List > > Subject: Re: how to use controllerclasses with tiles? > > > > > > Fahd, > > > > I've successfully implemented heaps of controller classes, but I'm > > having trouble visualising what you have done. > > > > Any chance of a code example? > > > > Mark > > > > On Fri, 16 Jul 2004 10:35:13 +0500, Fahd Ahmed <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > I am trying to use a controllerClass with Tiles. I am mentioning the > > > controllerClass in one of my definition tags. The controller does > > nothing > > > but put a varible in ComponentContext. On the JSP I just use the > > > importAttribute tag to get that value. But when i access the page, I > > keep > > on > > > getting the following error. > > > > > > [ServletException in:/layouts/threeColumnLayout.jsp] Error - Illegal > > class > > > access :Class org.apache.struts.tiles.ComponentDefinition can not > access > > a > > > member of class com.usersmarts.sam.tilescontroller.TestTileController > > with > > > modifiers "" > > > > > > threeColumnlayout is my layout JSP and TestTileController is the > > controller > > > class I am associating with the definition tag. > > > > > > Anyone who can think of a reason??? > > > > > > Regards > > > Fahd > > > > > > -- > > E: [EMAIL PROTECTED] > > W: www.compoundtheory.com > > ICQ: 3094740 > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]