You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Herbert Winter <wi...@gmail.com> on 2008/11/21 17:56:43 UTC

Wicket 1.4m3 and Javascript

hello list,

I try the following:
In the Java-file I have a list of key/value pairs(coming from
database), and I want to feed out the values of the props to js-Array
like:

String js="array = new Array(";
for (int i = 0; i < props.size(); i++) {

   XProperties p = (XProperties) props.get(i);
				
  String propvalue = p.getValue();
				
  js +="\"" + propvalue + "\"";
  if(i==props.size()-1) {}
   else {
	js +=",";
   }
}
js +=");";


How can I give this over to the HTML?
Html-file:
<script language="javascript">
here I want the String to come out like e.g. var array=new
Array("value1", "value2", "value3");

I am sure that someone here uses this, but I am lost in google, nabble
and wicketversions.

greetings

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket 1.4m3 and Javascript

Posted by Herbert Winter <wi...@gmail.com>.
Ah yes, thanks for the hint.
http://chillenious.wordpress.com/2006/05/03/wicket-header-contributions-with-behaviors/
is good on this.

2008/11/22 Jeremy Thomerson <je...@wickettraining.com>:
> You could use TextTemplateHeaderContributor
>
> jt
>
> On Fri, Nov 21, 2008 at 10:56 AM, Herbert Winter <wi...@gmail.com>wrote:
>
>> hello list,
>>
>> I try the following:
>> In the Java-file I have a list of key/value pairs(coming from
>> database), and I want to feed out the values of the props to js-Array
>> like:
>>
>> String js="array = new Array(";
>> for (int i = 0; i < props.size(); i++) {
>>
>>   XProperties p = (XProperties) props.get(i);
>>
>>  String propvalue = p.getValue();
>>
>>  js +="\"" + propvalue + "\"";
>>  if(i==props.size()-1) {}
>>   else {
>>        js +=",";
>>   }
>> }
>> js +=");";
>>
>>
>> How can I give this over to the HTML?
>> Html-file:
>> <script language="javascript">
>> here I want the String to come out like e.g. var array=new
>> Array("value1", "value2", "value3");
>>
>> I am sure that someone here uses this, but I am lost in google, nabble
>> and wicketversions.
>>
>> greetings
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket 1.4m3 and Javascript

Posted by Jeremy Thomerson <je...@wickettraining.com>.
You could use TextTemplateHeaderContributor

jt

On Fri, Nov 21, 2008 at 10:56 AM, Herbert Winter <wi...@gmail.com>wrote:

> hello list,
>
> I try the following:
> In the Java-file I have a list of key/value pairs(coming from
> database), and I want to feed out the values of the props to js-Array
> like:
>
> String js="array = new Array(";
> for (int i = 0; i < props.size(); i++) {
>
>   XProperties p = (XProperties) props.get(i);
>
>  String propvalue = p.getValue();
>
>  js +="\"" + propvalue + "\"";
>  if(i==props.size()-1) {}
>   else {
>        js +=",";
>   }
> }
> js +=");";
>
>
> How can I give this over to the HTML?
> Html-file:
> <script language="javascript">
> here I want the String to come out like e.g. var array=new
> Array("value1", "value2", "value3");
>
> I am sure that someone here uses this, but I am lost in google, nabble
> and wicketversions.
>
> greetings
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com