Re: Tiles Controller in definitions

2003-03-27 Thread Cedric Dumoulin


Kevin Cramer wrote:

I was playing around with this more and if I include the tile with the
controller directly in the JSP with the 
tag then it works.  If I use the  tag which
refers to an attribute which dynamically defines the definition / JSP
to use then it does not work.
 What is your exact syntax ?

Something like:

with "anAttribute" referencing a definition associated to a controller 
should call the controller.

 Cedric

Can this not be done?  I would prefer to do it the way I am doing
since the tile that is inserted there is specified in a parent tile.
Thanks,
Kevin
On Wed, Mar 26, 2003 at 10:27:23AM -0500, Kevin Cramer wrote:
 

If I put a System.out.println in the perform function, it never shows
up in the logs.  I'm positive it is not being called but I can't
figure out why.  I am using definitions and I saw a post from Cedric
that you need to use tiles:insert to get it working but I am doing
this in my JSP.
Any ideas?

Thanks,
Kevin
On Tue, Mar 25, 2003 at 09:54:16PM -0700, David Graham wrote:
   

Well there's only 1 method in the Controller interface:
http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html
What happens when you do a System.out... in the controller?

David



 

From: "Kevin Cramer" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Tiles Controller in definitions
Date: Tue, 25 Mar 2003 21:50:19 -0500
I'm trying to setup a controller for a Tiles definition.  I follow the
examples I've seen but it appears that the controller class is not
called.  I've seen posts here that indicate that you need to use
tiles:insert to enable the controller but I'm always using that
whenever I include the JSP.  Perhaps my use of tile definitions is
causing problems?  I'm also unsure whether I'm supposed to use the
perform() or execute() on the Controller interface.  The error I get
is that the JSP of the tile with the controller complains that it
cannot find the object that I am doing the putAttribute with.  The
error is on the tiles:importAttribute.
I have the following in my tiles-defs.xml:


  
  
  
  
  


  


  
  



Here is the testcontroller.jsp:

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>


Here is the controller class:

public final class TestAction extends TilesAction implements Controller {
  public static final String TEST_KEY = "TEST";
  public ActionForward perform(
  ComponentContext context,
  ActionMapping arg1,
  ActionForm arg2,
  HttpServletRequest arg3,
  HttpServletResponse arg4)
  throws IOException, ServletException {
  perform(context, arg3, arg4, 
getServlet().getServletContext());
  return null;
  }

  public void perform(
  ComponentContext context,
  HttpServletRequest arg1,
  HttpServletResponse arg2,
  ServletContext arg3)
  throws ServletException, IOException {
  MyTestObject test = new MyTestObject("Test Value");
  context.putAttribute(TEST_KEY, test);
  }
  public ActionForward execute(
  ComponentContext context,
  ActionMapping arg1,
  ActionForm arg2,
  HttpServletRequest arg3,
  HttpServletResponse arg4)
  throws Exception {
  perform(context, arg3, arg4, 
getServlet().getServletContext());
  return null;
  }
}

Thanks,
Kevin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
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]


Re: Tiles Controller in definitions

2003-03-26 Thread Kevin Cramer

I was playing around with this more and if I include the tile with the
controller directly in the JSP with the 
tag then it works.  If I use the  tag which
refers to an attribute which dynamically defines the definition / JSP
to use then it does not work.

Can this not be done?  I would prefer to do it the way I am doing
since the tile that is inserted there is specified in a parent tile.

Thanks,
Kevin

On Wed, Mar 26, 2003 at 10:27:23AM -0500, Kevin Cramer wrote:
> 
> If I put a System.out.println in the perform function, it never shows
> up in the logs.  I'm positive it is not being called but I can't
> figure out why.  I am using definitions and I saw a post from Cedric
> that you need to use tiles:insert to get it working but I am doing
> this in my JSP.
> 
> Any ideas?
> 
> Thanks,
> Kevin
> 
> On Tue, Mar 25, 2003 at 09:54:16PM -0700, David Graham wrote:
> > Well there's only 1 method in the Controller interface:
> > http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html
> > 
> > What happens when you do a System.out... in the controller?
> > 
> > David
> > 
> > 
> > 
> > >From: "Kevin Cramer" <[EMAIL PROTECTED]>
> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: Tiles Controller in definitions
> > >Date: Tue, 25 Mar 2003 21:50:19 -0500
> > >
> > >
> > >I'm trying to setup a controller for a Tiles definition.  I follow the
> > >examples I've seen but it appears that the controller class is not
> > >called.  I've seen posts here that indicate that you need to use
> > >tiles:insert to enable the controller but I'm always using that
> > >whenever I include the JSP.  Perhaps my use of tile definitions is
> > >causing problems?  I'm also unsure whether I'm supposed to use the
> > >perform() or execute() on the Controller interface.  The error I get
> > >is that the JSP of the tile with the controller complains that it
> > >cannot find the object that I am doing the putAttribute with.  The
> > >error is on the tiles:importAttribute.
> > >
> > >I have the following in my tiles-defs.xml:
> > >
> > > > >path="/WEB-INF/common/layouts/standardLayout.jsp">
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > > >path="/WEB-INF/common/header.jsp">
> > >
> > >
> > >
> > > > >path="/WEB-INF/common/bar.jsp">
> > >
> > >
> > >
> > >
> > >
> > > > >path="/WEB-INF/common/testcontroller.jsp"
> > >controllerClass="mytest.TestAction">
> > >
> > >
> > >Here is the testcontroller.jsp:
> > >
> > ><%@ taglib uri="/tags/struts-html" prefix="html" %>
> > ><%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
> > >
> > >
> > >
> > >
> > >
> > >Here is the controller class:
> > >
> > >public final class TestAction extends TilesAction implements Controller {
> > >public static final String TEST_KEY = "TEST";
> > >
> > >public ActionForward perform(
> > >ComponentContext context,
> > >ActionMapping arg1,
> > >ActionForm arg2,
> > >HttpServletRequest arg3,
> > >HttpServletResponse arg4)
> > >throws IOException, ServletException {
> > >
> > >perform(context, arg3, arg4, 
> > >getServlet().getServletContext());
> > >return null;
> > >}
> > >
> > >public void perform(
> > >ComponentContext context,
> > >HttpServletRequest arg1,
> > >HttpServletResponse arg2,
> > >ServletContext arg3)
> > >throws ServletException, IOException {
> > >
> > >MyTestObject test = new MyTestObject("Test Value");
> > >context.putAttribute(TEST_KEY, test);
> > >}
> > >
> > >public ActionForward execute(
> > >ComponentContext context,
> > >   

Re: Tiles Controller in definitions

2003-03-26 Thread Kevin Cramer

If I put a System.out.println in the perform function, it never shows
up in the logs.  I'm positive it is not being called but I can't
figure out why.  I am using definitions and I saw a post from Cedric
that you need to use tiles:insert to get it working but I am doing
this in my JSP.

Any ideas?

Thanks,
Kevin

On Tue, Mar 25, 2003 at 09:54:16PM -0700, David Graham wrote:
> Well there's only 1 method in the Controller interface:
> http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html
> 
> What happens when you do a System.out... in the controller?
> 
> David
> 
> 
> 
> >From: "Kevin Cramer" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Tiles Controller in definitions
> >Date: Tue, 25 Mar 2003 21:50:19 -0500
> >
> >
> >I'm trying to setup a controller for a Tiles definition.  I follow the
> >examples I've seen but it appears that the controller class is not
> >called.  I've seen posts here that indicate that you need to use
> >tiles:insert to enable the controller but I'm always using that
> >whenever I include the JSP.  Perhaps my use of tile definitions is
> >causing problems?  I'm also unsure whether I'm supposed to use the
> >perform() or execute() on the Controller interface.  The error I get
> >is that the JSP of the tile with the controller complains that it
> >cannot find the object that I am doing the putAttribute with.  The
> >error is on the tiles:importAttribute.
> >
> >I have the following in my tiles-defs.xml:
> >
> > >path="/WEB-INF/common/layouts/standardLayout.jsp">
> >
> >
> >
> >
> >
> >
> >
> > >path="/WEB-INF/common/header.jsp">
> >
> >
> >
> > >path="/WEB-INF/common/bar.jsp">
> >
> >
> >
> >
> >
> > >path="/WEB-INF/common/testcontroller.jsp"
> >controllerClass="mytest.TestAction">
> >
> >
> >Here is the testcontroller.jsp:
> >
> ><%@ taglib uri="/tags/struts-html" prefix="html" %>
> ><%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
> >
> >
> >
> >
> >
> >Here is the controller class:
> >
> >public final class TestAction extends TilesAction implements Controller {
> >public static final String TEST_KEY = "TEST";
> >
> >public ActionForward perform(
> >ComponentContext context,
> >ActionMapping arg1,
> >ActionForm arg2,
> >HttpServletRequest arg3,
> >HttpServletResponse arg4)
> >throws IOException, ServletException {
> >
> >perform(context, arg3, arg4, 
> >getServlet().getServletContext());
> >return null;
> >}
> >
> >public void perform(
> >ComponentContext context,
> >HttpServletRequest arg1,
> >HttpServletResponse arg2,
> >ServletContext arg3)
> >throws ServletException, IOException {
> >
> >MyTestObject test = new MyTestObject("Test Value");
> >context.putAttribute(TEST_KEY, test);
> >}
> >
> >public ActionForward execute(
> >ComponentContext context,
> >ActionMapping arg1,
> >ActionForm arg2,
> >HttpServletRequest arg3,
> >HttpServletResponse arg4)
> >throws Exception {
> >
> >perform(context, arg3, arg4, 
> >getServlet().getServletContext());
> >return null;
> >}
> >}
> >
> >
> >Thanks,
> >Kevin
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> _
> The new MSN 8: advanced junk mail protection and 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
> 
> 
> -
> 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]



Re: Tiles Controller in definitions

2003-03-26 Thread Cedric Dumoulin
 Hi,

 If you use a class as controller, you need to implement the Controller 
interface, which define only one method:

  public void perform(ComponentContext tileContext,
  HttpServletRequest request, HttpServletResponse 
response,
  ServletContext servletContext)
   throws ServletException, IOException;
 So you have to implement this method. Another solution is to extend 
the ControllerSupport class, which implement the Controller interface.
 The TilesAction class is a convenience class to be used with a 
controller URL.

 Cedric

Kevin Cramer wrote:

I'm trying to setup a controller for a Tiles definition.  I follow the
examples I've seen but it appears that the controller class is not
called.  I've seen posts here that indicate that you need to use
tiles:insert to enable the controller but I'm always using that
whenever I include the JSP.  Perhaps my use of tile definitions is
causing problems?  I'm also unsure whether I'm supposed to use the
perform() or execute() on the Controller interface.  The error I get
is that the JSP of the tile with the controller complains that it
cannot find the object that I am doing the putAttribute with.  The
error is on the tiles:importAttribute.
I have the following in my tiles-defs.xml:


   
   
   
   
   


   


   path="/WEB-INF/common/bar.jsp">
   
   



   controllerClass="mytest.TestAction">


Here is the testcontroller.jsp:

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>


Here is the controller class:

public final class TestAction extends TilesAction implements Controller {
   public static final String TEST_KEY = "TEST";
   public ActionForward perform(
   ComponentContext context,
   ActionMapping arg1,
   ActionForm arg2,
   HttpServletRequest arg3,
   HttpServletResponse arg4)
   throws IOException, ServletException {
   perform(context, arg3, arg4, getServlet().getServletContext());
   return null;
   }
   public void perform(
   ComponentContext context,
   HttpServletRequest arg1,
   HttpServletResponse arg2,
   ServletContext arg3)
   throws ServletException, IOException {
   MyTestObject test = new MyTestObject("Test Value");
   context.putAttribute(TEST_KEY, test);
   }
   public ActionForward execute(
   ComponentContext context,
   ActionMapping arg1,
   ActionForm arg2,
   HttpServletRequest arg3,
   HttpServletResponse arg4)
   throws Exception {
   perform(context, arg3, arg4, getServlet().getServletContext());
   return null;
   }
}
Thanks,
Kevin
-
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]


Re: Tiles Controller in definitions

2003-03-25 Thread David Graham
Well there's only 1 method in the Controller interface:
http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html
What happens when you do a System.out... in the controller?

David



From: "Kevin Cramer" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Tiles Controller in definitions
Date: Tue, 25 Mar 2003 21:50:19 -0500
I'm trying to setup a controller for a Tiles definition.  I follow the
examples I've seen but it appears that the controller class is not
called.  I've seen posts here that indicate that you need to use
tiles:insert to enable the controller but I'm always using that
whenever I include the JSP.  Perhaps my use of tile definitions is
causing problems?  I'm also unsure whether I'm supposed to use the
perform() or execute() on the Controller interface.  The error I get
is that the JSP of the tile with the controller complains that it
cannot find the object that I am doing the putAttribute with.  The
error is on the tiles:importAttribute.
I have the following in my tiles-defs.xml:

















Here is the testcontroller.jsp:

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>


Here is the controller class:

public final class TestAction extends TilesAction implements Controller {
public static final String TEST_KEY = "TEST";
public ActionForward perform(
ComponentContext context,
ActionMapping arg1,
ActionForm arg2,
HttpServletRequest arg3,
HttpServletResponse arg4)
throws IOException, ServletException {
perform(context, arg3, arg4, 
getServlet().getServletContext());
return null;
}

public void perform(
ComponentContext context,
HttpServletRequest arg1,
HttpServletResponse arg2,
ServletContext arg3)
throws ServletException, IOException {
MyTestObject test = new MyTestObject("Test Value");
context.putAttribute(TEST_KEY, test);
}
public ActionForward execute(
ComponentContext context,
ActionMapping arg1,
ActionForm arg2,
HttpServletRequest arg3,
HttpServletResponse arg4)
throws Exception {
perform(context, arg3, arg4, 
getServlet().getServletContext());
return null;
}
}

Thanks,
Kevin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Tiles Controller in definitions

2003-03-25 Thread Kevin Cramer

I'm trying to setup a controller for a Tiles definition.  I follow the
examples I've seen but it appears that the controller class is not
called.  I've seen posts here that indicate that you need to use
tiles:insert to enable the controller but I'm always using that
whenever I include the JSP.  Perhaps my use of tile definitions is
causing problems?  I'm also unsure whether I'm supposed to use the
perform() or execute() on the Controller interface.  The error I get
is that the JSP of the tile with the controller complains that it
cannot find the object that I am doing the putAttribute with.  The
error is on the tiles:importAttribute.

I have the following in my tiles-defs.xml:






















Here is the testcontroller.jsp:

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>





Here is the controller class:

public final class TestAction extends TilesAction implements Controller {
public static final String TEST_KEY = "TEST";

public ActionForward perform(
ComponentContext context,
ActionMapping arg1,
ActionForm arg2,
HttpServletRequest arg3,
HttpServletResponse arg4)
throws IOException, ServletException {

perform(context, arg3, arg4, getServlet().getServletContext());
return null;
}

public void perform(
ComponentContext context,
HttpServletRequest arg1,
HttpServletResponse arg2,
ServletContext arg3)
throws ServletException, IOException {

MyTestObject test = new MyTestObject("Test Value");
context.putAttribute(TEST_KEY, test);
}

public ActionForward execute(
ComponentContext context,
ActionMapping arg1,
ActionForm arg2,
HttpServletRequest arg3,
HttpServletResponse arg4)
throws Exception {

perform(context, arg3, arg4, getServlet().getServletContext());
return null;
}
}


Thanks,
Kevin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]