Re: creating dynamic text in web page
Or, if you need to parameterize a larger portion of javascript, you can use TextTemplates. (see DatePicker in wicket-datetime as an example) Gerolf On Fri, Mar 28, 2008 at 11:46 AM, Martijn Dashorst < [EMAIL PROTECTED]> wrote: > Another option: > > add(new Label("js", " > type=\"text/javascript\">alert('foo');").setEscapeModelStrings(false)); > > On 3/28/08, Joel Halbert <[EMAIL PROTECTED]> wrote: > > OK, I figured it out.. > > > > > > I can add javascript like this using add(new > StringHeaderContributor("insert > > my javascript here"));: > > > > > > public class MyPage extends WebPage { > > public MyPage(long sessionKey, String uniqueUsername) { > > String js = "" + > > " > ScriptSessionListener.notifyNewSessionClient(" + > > sessionKey + > > ", '" + > > uniqueUsername + > > "');"; > > add(new StringHeaderContributor(js)); > > } > > } > > > > (of course the tidier version would be just to write out the variables, > and > > have the js fn static on the page, but same deal) > > > > Thx > > Joel > > > > > > > > -- > > From: "Joel Halbert" <[EMAIL PROTECTED]> > > Sent: Friday, March 28, 2008 9:22 AM > > To: > > Subject: creating dynamic text in web page > > > > > > > Hi All, > > > > > > I would like to be able to insert text dynamically in a wicket web > page. > > > An example would be where the arguments for a JavaScript function > need to > > > by dynamic: > > > > > > > > > For example if I have something like this in my web page: > > > > > > > > > MyJavascriptObject.callMethod( ${sessionKey}, '${uniqueUsername}'); > > > > > > > > > > > > > > > > > > I would like the values of ${sessionKey} and ${uniqueUsername} to be > > > populated dynamically. > > > > > > > > > > > > Many Thanks, > > > > > > > > > > > > Joel Halbert > > > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Buy Wicket in Action: http://manning.com/dashorst > Apache Wicket 1.3.2 is released > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2 > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: creating dynamic text in web page
Another option: add(new Label("js", "alert('foo');").setEscapeModelStrings(false)); On 3/28/08, Joel Halbert <[EMAIL PROTECTED]> wrote: > OK, I figured it out.. > > > I can add javascript like this using add(new StringHeaderContributor("insert > my javascript here"));: > > > public class MyPage extends WebPage { > public MyPage(long sessionKey, String uniqueUsername) { > String js = "" + > > "ScriptSessionListener.notifyNewSessionClient(" + > sessionKey + > ", '" + > uniqueUsername + > "');"; > add(new StringHeaderContributor(js)); > } > } > > (of course the tidier version would be just to write out the variables, and > have the js fn static on the page, but same deal) > > Thx > Joel > > > > -- > From: "Joel Halbert" <[EMAIL PROTECTED]> > Sent: Friday, March 28, 2008 9:22 AM > To: > Subject: creating dynamic text in web page > > > > Hi All, > > > > I would like to be able to insert text dynamically in a wicket web page. > > An example would be where the arguments for a JavaScript function need to > > by dynamic: > > > > > > For example if I have something like this in my web page: > > > > > > MyJavascriptObject.callMethod( ${sessionKey}, '${uniqueUsername}'); > > > > > > > > > > > > I would like the values of ${sessionKey} and ${uniqueUsername} to be > > populated dynamically. > > > > > > > > Many Thanks, > > > > > > > > Joel Halbert > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.2 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: creating dynamic text in web page
OK, I figured it out.. I can add javascript like this using add(new StringHeaderContributor("insert my javascript here"));: public class MyPage extends WebPage { public MyPage(long sessionKey, String uniqueUsername) { String js = "" + "ScriptSessionListener.notifyNewSessionClient(" + sessionKey + ", '" + uniqueUsername + "');"; add(new StringHeaderContributor(js)); } } (of course the tidier version would be just to write out the variables, and have the js fn static on the page, but same deal) Thx Joel -- From: "Joel Halbert" <[EMAIL PROTECTED]> Sent: Friday, March 28, 2008 9:22 AM To: Subject: creating dynamic text in web page Hi All, I would like to be able to insert text dynamically in a wicket web page. An example would be where the arguments for a JavaScript function need to by dynamic: For example if I have something like this in my web page: MyJavascriptObject.callMethod( ${sessionKey}, '${uniqueUsername}'); I would like the values of ${sessionKey} and ${uniqueUsername} to be populated dynamically. Many Thanks, Joel Halbert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
creating dynamic text in web page
Hi All, I would like to be able to insert text dynamically in a wicket web page. An example would be where the arguments for a JavaScript function need to by dynamic: For example if I have something like this in my web page: MyJavascriptObject.callMethod( ${sessionKey}, '${uniqueUsername}'); I would like the values of ${sessionKey} and ${uniqueUsername} to be populated dynamically. Many Thanks, Joel Halbert