For some cases it is easier, more efficient or - as with behaviors -
simply the only way to write markup 'around' (before and after) the
actual tag that a component is coupled to. This is where
response.write can be used.

The interface to that could be made more to-the-purpose so that it you
can have writer.begin("div"); etc. We've talked about that before, but
decided against it as we don't want to give the impression that
directly writing to the stream is the preferred way to build
components. Rather, we like people to use compound components with
markup files, like Panels, first and only when there is a very good
reason for it use the response directly.

That said, and interface like that could easily be built.

public class MarkupWriter {

  private final Reponse response;

  public MarkupWriter(Response response) {
    this.response = response;
  }

  public void begin(String tag) {
    response.write("<");
    response.write(tag);
  }

  public void attribute(String attrib, String value) {
    response.write(attrib);
    response.write(" = \"");
    response.write(value);
    response.write("\"");
  }
}

I think it is too trivial to put this in Wicket core, but if we have a
decent implementation we could consider putting it in extensions.

Eelco


On 2/13/07, Robert . <[EMAIL PROTECTED]> wrote:
> Actually I encounter this raw HTML output in the Pro Wicket book on page
> 251.
> A custome AutoCompleteRenderer is used to render a choice
> protected void renderChoice(Object object, Response response)
>
> Could you give an example how to write custom HTML to the response in such a
> method, without having
> to do something like response.write("<div>");
>
> Robert
>
>
>
> On 2/12/07, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > in wicket you very very very very rarely output markup from your code. why
> do you need this?
> >
> > -igor
> >
> >
> >
> >
> > On 2/12/07, Robert . < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > I have been using Tapestry before and kinda enjoyed using the
> IMarkupWriter by doing things like
> > > writer.begin("div");
> > > writer.attribute("id", "abc");
> > > writer.println("text");
> > > writer.end();
> > >
> > > Is there an equivalent way of doing this in Wicket?
> > >
> > > Robert
> > >
> > >
> -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services,
> security?
> > > Get stuff done quickly with pre-integrated technology to make your job
> easier.
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> >
> >
> >
> -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to