Yes, just for now - until we know more about bindable, rs rs - use public
fields.
My code:
package com.mycompany.controlistener;
import org.apache.click.control.ActionLink;
import org.apache.click.Page;
public class ControlListenerType1Page extends Page {
/* Set the listener to this object's "onLinkClick" method. */
public ActionLink myLink = new ActionLink(this,"onLinkClick");
public String msg;
// ------------------------------------------------- Event Handlers
/**
* Handle the ActionLink control click event.
*/
public boolean onLinkClick() {
msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onLinkClick()</tt> invoked.";
return true;
}
}
On Thu, Mar 25, 2010 at 3:37 PM, Jiujing Gu <[email protected]> wrote:
> If I read you correctly, you are suggesting me to get rid of the
> three import statements. But, I added them in because without them, it
> would not compile.
>
> Jiujing
>
> On Thu, 2010-03-25 at 15:18 -0300, Gilberto C. Andrade wrote:
> > See my comments ..
> >
> > On Thu, Mar 25, 2010 at 2:45 PM, Jiujing Gu <[email protected]> wrote:
> > I copied everything from the user guide.
> >
> > Here is the ControlListenerType1.htm
> >
> > <html>
> > <head>
> > <link type="text/css" rel="stylesheet"
> > href="style.css"></link>
> > </head>
> > <body>
> >
> > Click myLink control <a href="$myLink.href">here</a>.
> >
> > #if ($msg)
> > <div id="msgDiv"> $msg </div>
> > #end
> >
> > </body>
> > </html>
> > ----------------
> > Here is click.xml
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <click-app>
> >
> > <pages package="quickstart.page"/>
> >
> > <mode value="debug"/>
> >
> > </click-app>
> > --------------------------------
> >
> > Here is the ControlListenerType1Page.java under
> > WEB-INF/classes/quickstart/page
> >
> > package quickstart.page;
> >
> > import org.apache.click.control.ActionLink;
> > import org.apache.click.Page;
> > import org.apache.click.util.Bindable;
> >
> > The problem occurs while using the bindable interface
> > So, remove this dependence and the annotations, like:
> > [code]
> > public class ControlListenerType1Page extends Page {
> >
> > /* Set the listener to this object's "onLinkClick" method. */
> > public ActionLink myLink = new ActionLink(this,"onLinkClick");
> >
> > public String msg;
> > [/code]
> >
> > I've have some problems with this interface. I'm only using the old
> > method until I get used it.
> >
> > Gilberto
> >
> >
> >
> > public class ControlListenerType1Page extends Page {
> >
> > /* Set the listener to this object's "onLinkClick" method.
> > */
> > @Bindable protected ActionLink myLink = new
> > ActionLink(this,
> > "onLinkClick");
> >
> > @Bindable protected String msg;
> >
> > // ------------------------------------------------- Event
> > Handlers
> >
> > /**
> > * Handle the ActionLink control click event.
> > */
> > public boolean onLinkClick() {
> > msg = "ControlListenerPage#" + hashCode()
> > + " object method <tt>onLinkClick()</tt> invoked.";
> >
> > return true;
> >
> > }
> >
> > }
> >
> > On Thu, 2010-03-25 at 14:35 -0300, Gilberto C. Andrade wrote:
> > > Can you show us the control-listener-type1.htm and
> > click.xml files?
> > > So, control-listener-type1.htm file will be mapped to
> > > ControlListenerType1Page.java.
> > >
> > > Regards,
> > >
> > > Gilberto
> > >
> > > On Thu, Mar 25, 2010 at 12:58 PM, Jiujing Gu
> > <[email protected]> wrote:
> > > Hello,
> > >
> > > I'm following the user guide. When I tried the
> > control
> > > listener type 1
> > > example in Chapter 1.2, I got an error message.
> > Please let me
> > > know
> > > what did I do wrong.
> > >
> > > Thanks,
> > > Jiujing
> > > ------------------------
> > >
> > > HTTP Status 404 - /TestClick/$myLink.href
> > >
> > >
> >
> ________________________________________________________________________
> > >
> > > type Status report
> > >
> > > message /TestClick/$myLink.href
> > >
> > > description The requested resource
> > (/TestClick/$myLink.href)
> > > is not
> > > available.
> > >
> > >
> > >
> >
> ________________________________________________________________________
> > > Apache Tomcat/5.5.26
> > >
> > >
> >
> >
> >
>
>