How to write HTML directly
Hi, I have a Java class which outputs HTML directly including HTML,HEAD and BODY tags. Using JSP I simply include this class as a bean and then have the JSP do something like ${bean.itsMethod} to have those tags written directly into my page. I'm just starting out with Wicket and wondered how I could use this same bean in Wicket pages. Thanks in advance. _ New Windows 7: Find the right PC for you. Learn more. http://www.microsoft.com/windows/buy/
Re: How to write HTML directly
Nick: On Mon, Oct 26, 2009 at 2:27 PM, nick kitching n_kitch...@hotmail.comwrote: I have a Java class which outputs HTML directly including HTML,HEAD and BODY tags. Using JSP I simply include this class as a bean and then have the JSP do something like ${bean.itsMethod} to have those tags written directly into my page. Wicket does not works like that. You write a plain HTML and then add the dynamic content with a class which extends WebPage. Please take a look to the wicket quickstart project in http://wicket.apache.org/quickstart.html . Cheers, -- Mauro Ciancio
Re: How to write HTML directly
add(new label(output, new propertymodel(this, itsMethod)).setescapemodelstrings(false)); and im markup wicket:container wicket:id=output/wicket:container -igor On Mon, Oct 26, 2009 at 10:27 AM, nick kitching n_kitch...@hotmail.com wrote: Hi, I have a Java class which outputs HTML directly including HTML,HEAD and BODY tags. Using JSP I simply include this class as a bean and then have the JSP do something like ${bean.itsMethod} to have those tags written directly into my page. I'm just starting out with Wicket and wondered how I could use this same bean in Wicket pages. Thanks in advance. _ New Windows 7: Find the right PC for you. Learn more. http://www.microsoft.com/windows/buy/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
Mauro, Thanks for your reply. I understand that Wicket doesn't work the same way and was wondering how this could be achieved. Is there just no way to output HTML directly? How would you use wicket to send an XML file, for example, or an image? -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26064181.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
Nick: On Mon, Oct 26, 2009 at 2:43 PM, NiJK n_kitch...@hotmail.com wrote: Thanks for your reply. I understand that Wicket doesn't work the same way and was wondering how this could be achieved. Is there just no way to output HTML directly? How would you use wicket to send an XML file, for example, or an image? As Igor said, you can send html directly using that code snippet. To send an image to the browser you could use any of the following classes: http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/image/resource/package-summary.html Cheers, -- Mauro Ciancio
Re: How to write HTML directly
igor.vaynberg wrote: add(new label(output, new propertymodel(this, itsMethod)).setescapemodelstrings(false)); and im markup wicket:container wicket:id=output/wicket:container -igor Igor, I just tried this and I end up with all the HTML contained within the wicket tags. Also, despite the setEscapeModelString(false), all the HTML is escaped. -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26064720.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
On Mon, Oct 26, 2009 at 11:17 AM, NiJK n_kitch...@hotmail.com wrote: igor.vaynberg wrote: add(new label(output, new propertymodel(this, itsMethod)).setescapemodelstrings(false)); and im markup wicket:container wicket:id=output/wicket:container -igor Igor, I just tried this and I end up with all the HTML contained within the wicket tags. you can say: setrenderbodyonly(true) to remove those, usually those would be stripped via a global setting or when your app is configured to run in deployment mode. Also, despite the setEscapeModelString(false), all the HTML is escaped. that is pretty weird. i just tried and it worked fine for me... -igor -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26064720.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
igor.vaynberg wrote: Also, despite the setEscapeModelString(false), all the HTML is escaped. that is pretty weird. i just tried and it worked fine for me... -igor Igor, Thanks for the info about setStripWicketTags(true). Something as simple as add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); is rendering as lt;h1gt;Hellolt;/h1gt; I take it you're not seeing the same? -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26067076.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
when you do view source in your browser, what does it show? -igor On Mon, Oct 26, 2009 at 1:33 PM, NiJK n_kitch...@hotmail.com wrote: igor.vaynberg wrote: Also, despite the setEscapeModelString(false), all the HTML is escaped. that is pretty weird. i just tried and it worked fine for me... -igor Igor, Thanks for the info about setStripWicketTags(true). Something as simple as add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); is rendering as h1Hello/h1 I take it you're not seeing the same? -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26067076.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
Try changing add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); to Label label = new Label(output,h1Hello/h1); label.setEscapeModelStrings(false); add(label); Jason NiJK wrote: igor.vaynberg wrote: Also, despite the setEscapeModelString(false), all the HTML is escaped. that is pretty weird. i just tried and it worked fine for me... -igor Igor, Thanks for the info about setStripWicketTags(true). Something as simple as add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); is rendering as lt;h1gt;Hellolt;/h1gt; I take it you're not seeing the same? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
Yes add(new Label(output,h1Hello/h1)) returns this which is the current component/page. Then, you're calling setEscapeModelStrings(false) on that, which is not what you want. You want: add(new Label(output,h1Hello/h1).setEscapeModelStrings(false)); Igor's example had the double end parens because he was using a PropertyModel. On Mon, Oct 26, 2009 at 4:43 PM, Jason Novotny jason.novo...@gmail.com wrote: Try changing add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); to Label label = new Label(output,h1Hello/h1); label.setEscapeModelStrings(false); add(label); Jason NiJK wrote: igor.vaynberg wrote: Also, despite the setEscapeModelString(false), all the HTML is escaped. that is pretty weird. i just tried and it worked fine for me... -igor Igor, Thanks for the info about setStripWicketTags(true). Something as simple as add(new Label(output,h1Hello/h1)).setEscapeModelStrings(false); is rendering as lt;h1gt;Hellolt;/h1gt; I take it you're not seeing the same? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to write HTML directly
James Carman-3 wrote: add(new Label(output,h1Hello/h1).setEscapeModelStrings(false)); Thanks for all your help on this, guys. And apologies to Igor for not paying attention to that syntax. -- View this message in context: http://www.nabble.com/How-to-write-HTML-directly-tp26063933p26067765.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org