You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com> on 2011/03/28 16:02:09 UTC
HTML comment tag
This is simple code and works, do you think this is a way to add dynamic
HTML comments that use some Wicket model?
Or have you done something else?
I am not as familiar with onComponentTagBody.
public class HtmlComment extends Label {
/**
* @see
org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.
MarkupStream,
* org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, "<!-- " +
getDefaultModelObjectAsString() + " -->");
}
}
and the output will be in the final HTML output:
<!-- DATA -->
RE: HTML comment tag
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
Oops, I didn't see this, is this the same thing?
java.lang.Object
org.apache.wicket.protocol.http.documentvalidation.Comment
-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com] On Behalf Of James Carman
Sent: Monday, March 28, 2011 1:04 PM
To: users@wicket.apache.org
Subject: Re: HTML comment tag
We do this in our application by doing:
add(new Label("debugInfo", new
DebugInfoModel()).setEscapeModelStrings(false).setRenderBodyOnly(true));
private static class DebugInfoModel extends LoadableDetachableModel<String>
{
@Override
protected String load()
{
return MessageFormat.format("<!-- \n" +
"Java Version: {1}\n" +
"Wicket Version: {0}\n" +
"Hibernate Version: {2}\n" +
"Spring Version: {3}\n" +
"Oracle Driver: {4}\n" +
"Application Server: {5}\n" +
"Operating System: {6}\n" +
"-->",
WebApplication.get().getFrameworkSettings().getVersion(),
System.getProperty("java.vendor") + " " + System.getProperty("java.version"),
versionOf(Hibernate.class),
versionOf(ApplicationContext.class),
versionOf(OracleDriver.class),
WebApplication.get().getServletContext().getServerInfo(),
System.getProperty("os.version"));
}
}
On Mon, Mar 28, 2011 at 1:00 PM, Brown, Berlin [GCG-PFS] <Be...@primerica.com> wrote:
> They may contain information like a build number, version number of
> application for debugging purposes that I can see on the rendered HTML
> output.
>
> I was thinking of sub-classing label because the output of a comment
> is similar to that kind of markup.
>
> -----Original Message-----
> From: Pedro Santos [mailto:pedrosans@gmail.com]
> Sent: Monday, March 28, 2011 12:19 PM
> To: users@wicket.apache.org
> Subject: Re: HTML comment tag
>
> An reusable behavior can be archived using the MarkupComponentBorder.
> On a side note, why do you want to write commented model values in
> markup?
>
> On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] <
> Berlin.Brown@primerica.com> wrote:
>
>> This is simple code and works, do you think this is a way to add
>> dynamic HTML comments that use some Wicket model?
>> Or have you done something else?
>>
>> I am not as familiar with onComponentTagBody.
>>
>> public class HtmlComment extends Label {
>>
>> /**
>> * @see
>>
> org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.
>> MarkupStream,
>> * org.apache.wicket.markup.ComponentTag)
>> */
>> @Override
>> protected void onComponentTagBody(final MarkupStream markupStream,
>> final ComponentTag openTag) {
>> replaceComponentTagBody(markupStream, openTag, "<!-- " +
>> getDefaultModelObjectAsString() + " -->");
>> }
>>
>> }
>>
>> and the output will be in the final HTML output:
>>
>> <!-- DATA -->
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: HTML comment tag
Posted by James Carman <ja...@carmanconsulting.com>.
We do this in our application by doing:
add(new Label("debugInfo", new
DebugInfoModel()).setEscapeModelStrings(false).setRenderBodyOnly(true));
private static class DebugInfoModel extends LoadableDetachableModel<String>
{
@Override
protected String load()
{
return MessageFormat.format("<!-- \n" +
"Java Version: {1}\n" +
"Wicket Version: {0}\n" +
"Hibernate Version: {2}\n" +
"Spring Version: {3}\n" +
"Oracle Driver: {4}\n" +
"Application Server: {5}\n" +
"Operating System: {6}\n" +
"-->",
WebApplication.get().getFrameworkSettings().getVersion(),
System.getProperty("java.vendor") + " " +
System.getProperty("java.version"),
versionOf(Hibernate.class),
versionOf(ApplicationContext.class),
versionOf(OracleDriver.class),
WebApplication.get().getServletContext().getServerInfo(),
System.getProperty("os.version"));
}
}
On Mon, Mar 28, 2011 at 1:00 PM, Brown, Berlin [GCG-PFS]
<Be...@primerica.com> wrote:
> They may contain information like a build number, version number of
> application for debugging purposes that I can see on the rendered HTML
> output.
>
> I was thinking of sub-classing label because the output of a comment is
> similar to that kind of markup.
>
> -----Original Message-----
> From: Pedro Santos [mailto:pedrosans@gmail.com]
> Sent: Monday, March 28, 2011 12:19 PM
> To: users@wicket.apache.org
> Subject: Re: HTML comment tag
>
> An reusable behavior can be archived using the MarkupComponentBorder.
> On a side note, why do you want to write commented model values in
> markup?
>
> On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] <
> Berlin.Brown@primerica.com> wrote:
>
>> This is simple code and works, do you think this is a way to add
>> dynamic HTML comments that use some Wicket model?
>> Or have you done something else?
>>
>> I am not as familiar with onComponentTagBody.
>>
>> public class HtmlComment extends Label {
>>
>> /**
>> * @see
>>
> org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.
>> MarkupStream,
>> * org.apache.wicket.markup.ComponentTag)
>> */
>> @Override
>> protected void onComponentTagBody(final MarkupStream markupStream,
>> final ComponentTag openTag) {
>> replaceComponentTagBody(markupStream, openTag, "<!-- " +
>> getDefaultModelObjectAsString() + " -->");
>> }
>>
>> }
>>
>> and the output will be in the final HTML output:
>>
>> <!-- DATA -->
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: HTML comment tag
Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
They may contain information like a build number, version number of
application for debugging purposes that I can see on the rendered HTML
output.
I was thinking of sub-classing label because the output of a comment is
similar to that kind of markup.
-----Original Message-----
From: Pedro Santos [mailto:pedrosans@gmail.com]
Sent: Monday, March 28, 2011 12:19 PM
To: users@wicket.apache.org
Subject: Re: HTML comment tag
An reusable behavior can be archived using the MarkupComponentBorder.
On a side note, why do you want to write commented model values in
markup?
On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] <
Berlin.Brown@primerica.com> wrote:
> This is simple code and works, do you think this is a way to add
> dynamic HTML comments that use some Wicket model?
> Or have you done something else?
>
> I am not as familiar with onComponentTagBody.
>
> public class HtmlComment extends Label {
>
> /**
> * @see
>
org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.
> MarkupStream,
> * org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTagBody(final MarkupStream markupStream,
> final ComponentTag openTag) {
> replaceComponentTagBody(markupStream, openTag, "<!-- " +
> getDefaultModelObjectAsString() + " -->");
> }
>
> }
>
> and the output will be in the final HTML output:
>
> <!-- DATA -->
>
--
Pedro Henrique Oliveira dos Santos
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: HTML comment tag
Posted by Pedro Santos <pe...@gmail.com>.
An reusable behavior can be archived using the MarkupComponentBorder.
On a side note, why do you want to write commented model values in markup?
On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] <
Berlin.Brown@primerica.com> wrote:
> This is simple code and works, do you think this is a way to add dynamic
> HTML comments that use some Wicket model?
> Or have you done something else?
>
> I am not as familiar with onComponentTagBody.
>
> public class HtmlComment extends Label {
>
> /**
> * @see
> org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup.
> MarkupStream,
> * org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTagBody(final MarkupStream markupStream,
> final ComponentTag openTag) {
> replaceComponentTagBody(markupStream, openTag, "<!-- " +
> getDefaultModelObjectAsString() + " -->");
> }
>
> }
>
> and the output will be in the final HTML output:
>
> <!-- DATA -->
>
--
Pedro Henrique Oliveira dos Santos