JSONLiteral is a hack ... in fact, it transforms what is being sent
into something that is no longer JSON.  This is necessary for certain
components that initialize themselves using JavaScript object notation
(not JSON, which is a specific subset).  The JSONLiteral often is a
symbol (to reference a function or constant defined elsewhere) or an
inline annonymous function.

Use with care.  Better yet, don't use at all.

On Wed, Jul 13, 2011 at 4:48 PM, Taha Hafeez <tawus.tapes...@gmail.com> wrote:
> By using JSONLiteral you are sending the value without quotes. But the
> problem is how your value is interpreted by javascript. A string
> literal without quotes will be interpreted as a variable and as that
> variable is not defined you will get an error.
>
> Can you share the actual code ?
>
> regards
> Taha
>
> On Thu, Jul 14, 2011 at 4:53 AM, iberck <ibe...@gmail.com> wrote:
>>
>> I'm using
>> Taha Hafeez wrote:
>> >
>> > Hi
>> >
>> > When you specify something as a JSONLiteral, it is displayed as is and no
>> > quotes are applied. So the JSON is your case becomes
>> >
>> > { strkey: strvalue}
>> >
>> > so javascript tries to find the variable strvalue which is not there.
>> >
>> > When you don't specify JSONLiteral, JSON is
>> >
>> > {strkey : "strvalue"}
>> >
>> > which is fine.
>> >
>> >  Have you debugged it in firebug or chrome, it may be showing undefined
>> > variable or something
>> >
>> > regards
>> > Taha
>> >
>> > On Thu, Jul 14, 2011 at 1:46 AM, iberck &lt;ibe...@gmail.com&gt; wrote:
>> >
>> >> When I send the JSONObject: jsSupport.addInitializerCall("test1",
>> >> jobj.toCompactString()); IT WORKS
>> >>
>> >> Thanks in advance ;)
>> >>
>> >> --
>> >> View this message in context:
>> >> http://tapestry.1045711.n5.nabble.com/T5-2-6-JSONLiteral-Bug-tp4584187p4584206.html
>> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> >>
>> >
>>
>> Thank you for your response Taha, I need the format {"key": value} because
>> I'm using JQPlot library and it requires that json format
>>
>> Do you know are there another way to send the value from Tapestry without
>> quotes ?
>> I'm fixing the bug sending the json as compacted string and then breaking it
>> in javascript :S
>>
>> Thank you
>>
>>
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/T5-2-6-JSONLiteral-Bug-tp4584187p4584672.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to