Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 5 Feb 2008 19:37:04 -0000 Issue 7849

user-digest-help

2008-02-05


Author LoginPost Reply

user Digest 5 Feb 2008 19:37:04 -0000 Issue 7849

Topics (messages 182274 through 182279):

Re: AjaxTag 1.3 support?
 182274 by: Musachy Barroso
 182277 by: Griffith, Michael *
 182278 by: Musachy Barroso
 182279 by: Griffith, Michael *

Re: Custom OGNL PropertyAccessor
 182275 by: Laurie Harper

Tabs and Forms
 182276 by: Shanna7463

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_182274.ezm (zipped)
add:

<param name="wrapWithComments">false</param>

to the result. See the section "Wrap with Comments" here:

http://cwiki.apache.org/S2PLUGINS/json-plugin.html

musachy

On Feb 5, 2008 12:58 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Musachy,
>
> I've looked over the documentation, and looked in the JSONWriter class
> -- and it is not obvious to me how to configure this plugin setting.
> How is it done?
>
> MG
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@(protected)]
> Sent: Tuesday, February 05, 2008 11:23 AM
> To: Struts Users Mailing List
>
> Subject: Re: AjaxTag 1.3 support?
>
> Don't give up so easily :). That is just a setting on the json plugin
> to prevent cross site scripting, and can be disabled.
>
> musachy
>
> On Feb 5, 2008 11:27 AM, Griffith, Michael *
> <Michael.Griffith@(protected):
> > Well, to answer my own question -- the answer is no. The JSON result
> > serialization process escapes quotation marks, so my response that
> > looked like this before serialization:
> >
> > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > application?","440":"If your Java Application is an SE application
> does
> > it use Java Web Start?","450":"If your Java Application is a Java Web
> > Application, list the application server used for
> > production","490":"List any Java Web Services Technologies
> > Used","500":"List any Java Web Application Technologies Used for
> > presentation","510":"List any Java EE Technologies used in your
> > application"}}
> >
> > Looks like this after serialization:
> >
> > "{\"questions\":{\"420\":\"Is your Java Application a ME, SE or EE
> > application?\",\"440\":\"If your Java Application is an SE application
> > does it use Java Web Start?\",\"450\":\"If your Java Application is a
> > Java Web Application, list the application server used for
> > production\",\"490\":\"List any Java Web Services Technologies
> > Used\",\"500\":\"List any Java Web Application Technologies Used for
> > presentation\",\"510\":\"List any Java EE Technologies used in your
> > application\"}}"
> >
> > Making it unrecognizable to the autocompleter. This is pretty
> > frustrating to me. Maybe I am expecting this to do something that it
> was
> > never designed to do. My end goal was to be able to evaluate the ID of
> > the question that the user selected from the autocompleter.
> >
> > I'm giving up this path and looking elsewhere. Thanks to everyone
> that
> > replied to my question and tried to help me.
> >
> > MG
> >
> >
> > -----Original Message-----
> > From: Griffith, Michael * [mailto:Michael.Griffith@(protected)]
> > Sent: Tuesday, February 05, 2008 8:32 AM
> > To: Struts Users Mailing List
> > Subject: RE: AjaxTag 1.3 support?
> >
> > Musachy,
> >
> > I can't seem to create the right blend of Entity objects/list/maps to
> > allow the JSON plug in to serialize this response for me. If I create
> > the string below using a loop, can I return it from the JSON plug in
> > without the plug in doing anything further to it?
> >
> > In other words, does the plug in look at what it is trying to
> serialize
> > and say, "Hey this is already valid JSON, I don't need to do anything
> to
> > it..." or will it try to add additional info to the string returned?
> >
> > I'm guessing the shortest path for me is to just create the string in
> my
> > own serialization loop, but I don't want to confuse the plug in -- if
> > that makes any sense.
> >
> > MG
> >
> > -----Original Message-----
> > From: Musachy Barroso [mailto:musachy@(protected)]
> > Sent: Monday, February 04, 2008 6:30 PM
> > To: Struts Users Mailing List
> > Subject: Re: AjaxTag 1.3 support?
> >
> > Right on.
> >
> > On Feb 4, 2008 6:45 PM, Griffith, Michael *
> > <Michael.Griffith@(protected):
> > > Dave,
> > >
> > > I think the bigger problem is the JSON that is returned, while it
> may
> > be
> > > valid, it not in the right structure expected. I should be
> generating
> > > JSON like this:
> > >
> > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > application?","440":"If your Java Application is an SE application
> > does
> > > it use Java Web Start?"}}
> > >
> > > The [] brackets seem to be ignored by the parser.
> > >
> > > -----Original Message-----
> > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > Sent: Monday, February 04, 2008 5:34 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: AjaxTag 1.3 support?
> > >
> > > ...
> > >
> > >
> > > That's probably an issue.
> > >
> > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > > Yea, I think so -- I copied and pasted this from the log
> > > file/console...
> > > >
> > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > >
> > > > Is it generating those brackets around your JSON?
> > > >
> > > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > >
> > > > > Musachy,
> > > > >
> > > > > Thanks for your many replies... Does this JSON look like the
> right
> > > > > format? As far as I can tell, it matches your snippet below --
> but
> > I
> > > > get
> > > > > the same dojo parting error.
> > > > >
> > > > > [{"questions":{"420":"Is your Java Application a ME, SE or EE
> > > > > application?"}},{"questions":{"440":"If your Java Application is
> > an
> > > SE
> > > > > application does it use Java Web
> Start?"}},{"questions":{"450":"If
> > > > your
> > > > > Java Application is a Java Web Application, list the application
> > > > server
> > > > > used for production"}}]
> > > > >
> > > > > -----Original Message-----
> > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > Sent: Monday, February 04, 2008 3:52 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: AjaxTag 1.3 support?
> > > > >
> > > > > The rule to use a map (simplest one) was added on 2.1, on 2.0.x
> > the
> > > > > easiest way to generate the json is to have an object with a map
> > > field
> > > > > that matches the name of "dataFieldName" in the autocompleter
> tag:
> > > > >
> > > > > class QuestionJson {
> > > > >  private Map questions;
> > > > >  ....
> > > > > }
> > > > >
> > > > > public QuestionJson getQuestionJson() {
> > > > >  Question q= ... [from my list]
> > > > >   Map m = new HaswhMap();
> > > > >   m.put("Key1", q.getQuestion1());
> > > > >   m.put("Key2", q.getQuestion2());
> > > > >   return new QuestionJson(m);
> > > > > }
> > > > >
> > > > > <s:autocompleter ... dataFieldName="questions" ../>
> > > > >
> > > > > that will generate something like:
> > > > >
> > > > > {
> > > > >  "questions": {
> > > > >    "Key1" : "Question 1",
> > > > >    "Key2" : "Question 2",
> > > > >  }
> > > > > }
> > > > >
> > > > > //that's the idea, but I typed out of what I remember which is
> > often
> > > > not
> > > > > good :)
> > > > >
> > > > > musachy
> > > > >
> > > > > On Feb 4, 2008 4:34 PM, Griffith, Michael *
> > > > > <Michael.Griffith@(protected):
> > > > > > Musachy,
> > > > > >
> > > > > > I'm still not getting it...
> > > > > > I am now serializing a list of maps with the entity id and
> text
> > I
> > > > > > want...
> > > > > >
> > > > > > Map<String,String> m= new HashMap<String,String>();
> > > > > > Question q= ... [from my list]
> > > > > > m.put("id", q.getId().toString());
> > > > > > m.put("text", q.getText());
> > > > > > newList.add(m);
> > > > > >
> > > > > > And my JSON result looks:
> > > > > >
> > > > > > [JSON][{"text":"Is your Java Application a ME, SE or EE
> > > > > > application?","id":"420"},{"text":"If your Java Application is
> > an
> > > SE
> > > > > > application does it use Java Web
> Start?","id":"440"},{"text":"If
> > > > your
> > > > > > Java Application is a Java Web Application, list the
> application
> > > > > server
> > > > > > used for production","id":"450"},{"text":"List any Java Web
> > > Services
> > > > > > Technologies Used","id":"490"},{"text":"List any Java Web
> > > > Application
> > > > > > Technologies Used for presentation","id":"500"},{"text":"List
> > any
> > > > Java
> > > > > > EE Technologies used in your application","id":"510"}]
> > > > > >
> > > > > > I added the @JSON annotation as such:
> > > > > >
> > > > > >      @JSON(name="question")
> > > > > >      public List<Map<String,String>> getNewList(){
> > > > > >           return newList;
> > > > > >      }
> > > > > >
> > > > > > But it appears to be ignored.
> > > > > >
> > > > > > MG
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > >
> > > > > > Sent: Monday, February 04, 2008 2:53 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > >
> > > > > > Take a look here:
> > > > > >
> > > > > > http://cwiki.apache.org/S2PLUGINS/json-plugin.html
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On Feb 4, 2008 3:43 PM, Griffith, Michael *
> > > > > > <Michael.Griffith@(protected):
> > > > > > > So, if you have an array of Entity objects, in my case
> > question:
> > > > > > >
> > > > > > > How can I produce?
> > > > > > > {
> > > > > > >    "question" : [
> > > > > > >       ["1","question 1 text..."],
> > > > > > >       ["2","question 2 text..."]
> > > > > > >
> > > > > > >    ]
> > > > > > > }
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > Sent: Monday, February 04, 2008 2:37 PM
> > > > > > > To: Struts Users Mailing List
> > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > >
> > > > > > > yes, but the output will depend on what you feed the JSON
> > > result.
> > > > > > >
> > > > > > > musachy
> > > > > > >
> > > > > > > On Feb 4, 2008 3:20 PM, Griffith, Michael *
> > > > > > > <Michael.Griffith@(protected):
> > > > > > > > Musachy,
> > > > > > > >
> > > > > > > > I must have missed your point. Isn't the idea of using the
> > > JSON
> > > > > > > plug-in
> > > > > > > > so you don't have to iterate and create the list? If I
> have
> > an
> > > > > array
> > > > > > > or
> > > > > > > > Entity objects or maps, isn't there a way that the plug-in
> > > will
> > > > > > create
> > > > > > > > the JSON specified below?
> > > > > > > >
> > > > > > > > MG
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > Sent: Monday, February 04, 2008 1:56 PM
> > > > > > > > To: Struts Users Mailing List
> > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > >
> > > > > > > >
> > > > > > > > to use the dataFIeldName, you have to return something
> like:
> > > > > > > >
> > > > > > > > {
> > > > > > > >   "state" : [
> > > > > > > >      ["Alabama","AL"],
> > > > > > > >      ["Alaska","AK"]
> > > > > > > >   ]
> > > > > > > > }
> > > > > > > >
> > > > > > > > if you are using 2.1 check this link:
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://cwiki.apache.org/WW/ajax-and-javascript-recipes.html#AjaxandJavaS
> > > > > > > > criptRecipes-Autocompleter
> > > > > > > >
> > > > > > > > otherwise just an array of arrays should do:
> > > > > > > >
> > > > > > > > [
> > > > > > > >   ["Alabama", "AL"],
> > > > > > > >   ["Alaska", "AK"]
> > > > > > > > ]
> > > > > > > >
> > > > > > > > musachy
> > > > > > > >
> > > > > > > > On Feb 4, 2008 2:46 PM, Griffith, Michael *
> > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > Musachy
> > > > > > > > >
> > > > > > > > > Here is the autocompleter tag and the JSON returned...
> > > > > > > > >
> > > >
> > > === message truncated ===
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment: user_182277.ezm (zipped)
Musachy,

Huh? That can't be right...

First of all, the document says it wraps the JSON result in /* ... */
comments, it doesn't say anything about escaping quotes.

Second, the default value is false ;-) Adding this to the result
configuration did nothing to my result. This seems like a bug.

MG

-----Original Message-----
From: Musachy Barroso [mailto:musachy@(protected)]
Sent: Tuesday, February 05, 2008 12:14 PM
To: Struts Users Mailing List
Subject: Re: AjaxTag 1.3 support?

add:

<param name="wrapWithComments">false</param>

to the result. See the section "Wrap with Comments" here:

http://cwiki.apache.org/S2PLUGINS/json-plugin.html

musachy

On Feb 5, 2008 12:58 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Musachy,
>
> I've looked over the documentation, and looked in the JSONWriter class
> -- and it is not obvious to me how to configure this plugin setting.
> How is it done?
>
> MG
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@(protected)]
> Sent: Tuesday, February 05, 2008 11:23 AM
> To: Struts Users Mailing List
>
> Subject: Re: AjaxTag 1.3 support?
>
> Don't give up so easily :). That is just a setting on the json plugin
> to prevent cross site scripting, and can be disabled.
>
> musachy
>
> On Feb 5, 2008 11:27 AM, Griffith, Michael *
> <Michael.Griffith@(protected):
> > Well, to answer my own question -- the answer is no. The JSON result
> > serialization process escapes quotation marks, so my response that
> > looked like this before serialization:
> >
> > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > application?","440":"If your Java Application is an SE application
> does
> > it use Java Web Start?","450":"If your Java Application is a Java
Web
> > Application, list the application server used for
> > production","490":"List any Java Web Services Technologies
> > Used","500":"List any Java Web Application Technologies Used for
> > presentation","510":"List any Java EE Technologies used in your
> > application"}}
> >
> > Looks like this after serialization:
> >
> > "{\"questions\":{\"420\":\"Is your Java Application a ME, SE or EE
> > application?\",\"440\":\"If your Java Application is an SE
application
> > does it use Java Web Start?\",\"450\":\"If your Java Application is
a
> > Java Web Application, list the application server used for
> > production\",\"490\":\"List any Java Web Services Technologies
> > Used\",\"500\":\"List any Java Web Application Technologies Used for
> > presentation\",\"510\":\"List any Java EE Technologies used in your
> > application\"}}"
> >
> > Making it unrecognizable to the autocompleter. This is pretty
> > frustrating to me. Maybe I am expecting this to do something that it
> was
> > never designed to do. My end goal was to be able to evaluate the ID
of
> > the question that the user selected from the autocompleter.
> >
> > I'm giving up this path and looking elsewhere. Thanks to everyone
> that
> > replied to my question and tried to help me.
> >
> > MG
> >
> >
> > -----Original Message-----
> > From: Griffith, Michael * [mailto:Michael.Griffith@(protected)]
> > Sent: Tuesday, February 05, 2008 8:32 AM
> > To: Struts Users Mailing List
> > Subject: RE: AjaxTag 1.3 support?
> >
> > Musachy,
> >
> > I can't seem to create the right blend of Entity objects/list/maps
to
> > allow the JSON plug in to serialize this response for me. If I
create
> > the string below using a loop, can I return it from the JSON plug in
> > without the plug in doing anything further to it?
> >
> > In other words, does the plug in look at what it is trying to
> serialize
> > and say, "Hey this is already valid JSON, I don't need to do
anything
> to
> > it..." or will it try to add additional info to the string returned?
> >
> > I'm guessing the shortest path for me is to just create the string
in
> my
> > own serialization loop, but I don't want to confuse the plug in --
if
> > that makes any sense.
> >
> > MG
> >
> > -----Original Message-----
> > From: Musachy Barroso [mailto:musachy@(protected)]
> > Sent: Monday, February 04, 2008 6:30 PM
> > To: Struts Users Mailing List
> > Subject: Re: AjaxTag 1.3 support?
> >
> > Right on.
> >
> > On Feb 4, 2008 6:45 PM, Griffith, Michael *
> > <Michael.Griffith@(protected):
> > > Dave,
> > >
> > > I think the bigger problem is the JSON that is returned, while it
> may
> > be
> > > valid, it not in the right structure expected. I should be
> generating
> > > JSON like this:
> > >
> > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > application?","440":"If your Java Application is an SE application
> > does
> > > it use Java Web Start?"}}
> > >
> > > The [] brackets seem to be ignored by the parser.
> > >
> > > -----Original Message-----
> > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > Sent: Monday, February 04, 2008 5:34 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: AjaxTag 1.3 support?
> > >
> > > ...
> > >
> > >
> > > That's probably an issue.
> > >
> > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > > Yea, I think so -- I copied and pasted this from the log
> > > file/console...
> > > >
> > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > >
> > > > Is it generating those brackets around your JSON?
> > > >
> > > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > >
> > > > > Musachy,
> > > > >
> > > > > Thanks for your many replies... Does this JSON look like the
> right
> > > > > format? As far as I can tell, it matches your snippet below --
> but
> > I
> > > > get
> > > > > the same dojo parting error.
> > > > >
> > > > > [{"questions":{"420":"Is your Java Application a ME, SE or EE
> > > > > application?"}},{"questions":{"440":"If your Java Application
is
> > an
> > > SE
> > > > > application does it use Java Web
> Start?"}},{"questions":{"450":"If
> > > > your
> > > > > Java Application is a Java Web Application, list the
application
> > > > server
> > > > > used for production"}}]
> > > > >
> > > > > -----Original Message-----
> > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > Sent: Monday, February 04, 2008 3:52 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: AjaxTag 1.3 support?
> > > > >
> > > > > The rule to use a map (simplest one) was added on 2.1, on
2.0.x
> > the
> > > > > easiest way to generate the json is to have an object with a
map
> > > field
> > > > > that matches the name of "dataFieldName" in the autocompleter
> tag:
> > > > >
> > > > > class QuestionJson {
> > > > >  private Map questions;
> > > > >  ....
> > > > > }
> > > > >
> > > > > public QuestionJson getQuestionJson() {
> > > > >  Question q= ... [from my list]
> > > > >   Map m = new HaswhMap();
> > > > >   m.put("Key1", q.getQuestion1());
> > > > >   m.put("Key2", q.getQuestion2());
> > > > >   return new QuestionJson(m);
> > > > > }
> > > > >
> > > > > <s:autocompleter ... dataFieldName="questions" ../>
> > > > >
> > > > > that will generate something like:
> > > > >
> > > > > {
> > > > >  "questions": {
> > > > >    "Key1" : "Question 1",
> > > > >    "Key2" : "Question 2",
> > > > >  }
> > > > > }
> > > > >
> > > > > //that's the idea, but I typed out of what I remember which is
> > often
> > > > not
> > > > > good :)
> > > > >
> > > > > musachy
> > > > >
> > > > > On Feb 4, 2008 4:34 PM, Griffith, Michael *
> > > > > <Michael.Griffith@(protected):
> > > > > > Musachy,
> > > > > >
> > > > > > I'm still not getting it...
> > > > > > I am now serializing a list of maps with the entity id and
> text
> > I
> > > > > > want...
> > > > > >
> > > > > > Map<String,String> m= new HashMap<String,String>();
> > > > > > Question q= ... [from my list]
> > > > > > m.put("id", q.getId().toString());
> > > > > > m.put("text", q.getText());
> > > > > > newList.add(m);
> > > > > >
> > > > > > And my JSON result looks:
> > > > > >
> > > > > > [JSON][{"text":"Is your Java Application a ME, SE or EE
> > > > > > application?","id":"420"},{"text":"If your Java Application
is
> > an
> > > SE
> > > > > > application does it use Java Web
> Start?","id":"440"},{"text":"If
> > > > your
> > > > > > Java Application is a Java Web Application, list the
> application
> > > > > server
> > > > > > used for production","id":"450"},{"text":"List any Java Web
> > > Services
> > > > > > Technologies Used","id":"490"},{"text":"List any Java Web
> > > > Application
> > > > > > Technologies Used for
presentation","id":"500"},{"text":"List
> > any
> > > > Java
> > > > > > EE Technologies used in your application","id":"510"}]
> > > > > >
> > > > > > I added the @JSON annotation as such:
> > > > > >
> > > > > >      @JSON(name="question")
> > > > > >      public List<Map<String,String>> getNewList(){
> > > > > >           return newList;
> > > > > >      }
> > > > > >
> > > > > > But it appears to be ignored.
> > > > > >
> > > > > > MG
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > >
> > > > > > Sent: Monday, February 04, 2008 2:53 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > >
> > > > > > Take a look here:
> > > > > >
> > > > > > http://cwiki.apache.org/S2PLUGINS/json-plugin.html
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On Feb 4, 2008 3:43 PM, Griffith, Michael *
> > > > > > <Michael.Griffith@(protected):
> > > > > > > So, if you have an array of Entity objects, in my case
> > question:
> > > > > > >
> > > > > > > How can I produce?
> > > > > > > {
> > > > > > >    "question" : [
> > > > > > >       ["1","question 1 text..."],
> > > > > > >       ["2","question 2 text..."]
> > > > > > >
> > > > > > >    ]
> > > > > > > }
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > Sent: Monday, February 04, 2008 2:37 PM
> > > > > > > To: Struts Users Mailing List
> > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > >
> > > > > > > yes, but the output will depend on what you feed the JSON
> > > result.
> > > > > > >
> > > > > > > musachy
> > > > > > >
> > > > > > > On Feb 4, 2008 3:20 PM, Griffith, Michael *
> > > > > > > <Michael.Griffith@(protected):
> > > > > > > > Musachy,
> > > > > > > >
> > > > > > > > I must have missed your point. Isn't the idea of using
the
> > > JSON
> > > > > > > plug-in
> > > > > > > > so you don't have to iterate and create the list? If I
> have
> > an
> > > > > array
> > > > > > > or
> > > > > > > > Entity objects or maps, isn't there a way that the
plug-in
> > > will
> > > > > > create
> > > > > > > > the JSON specified below?
> > > > > > > >
> > > > > > > > MG
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > Sent: Monday, February 04, 2008 1:56 PM
> > > > > > > > To: Struts Users Mailing List
> > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > >
> > > > > > > >
> > > > > > > > to use the dataFIeldName, you have to return something
> like:
> > > > > > > >
> > > > > > > > {
> > > > > > > >   "state" : [
> > > > > > > >      ["Alabama","AL"],
> > > > > > > >      ["Alaska","AK"]
> > > > > > > >   ]
> > > > > > > > }
> > > > > > > >
> > > > > > > > if you are using 2.1 check this link:
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
http://cwiki.apache.org/WW/ajax-and-javascript-recipes.html#AjaxandJavaS
> > > > > > > > criptRecipes-Autocompleter
> > > > > > > >
> > > > > > > > otherwise just an array of arrays should do:
> > > > > > > >
> > > > > > > > [
> > > > > > > >   ["Alabama", "AL"],
> > > > > > > >   ["Alaska", "AK"]
> > > > > > > > ]
> > > > > > > >
> > > > > > > > musachy
> > > > > > > >
> > > > > > > > On Feb 4, 2008 2:46 PM, Griffith, Michael *
> > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > Musachy
> > > > > > > > >
> > > > > > > > > Here is the autocompleter tag and the JSON returned...
> > > > > > > > >
> > > >
> > > === message truncated ===
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)




Attachment: user_182278.ezm (zipped)
Oh I am sorry about that! (doh) Do you see the quoutes escaped in
firebug or something? As far as I remember the plugin doesnt escape
the quoutes. If you put the url in your browser you should see the
generated json as it actually is.

musachy

On Feb 5, 2008 2:12 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Musachy,
>
> Huh? That can't be right...
>
> First of all, the document says it wraps the JSON result in /* ... */
> comments, it doesn't say anything about escaping quotes.
>
> Second, the default value is false ;-) Adding this to the result
> configuration did nothing to my result. This seems like a bug.
>
> MG
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@(protected)]
>
> Sent: Tuesday, February 05, 2008 12:14 PM
> To: Struts Users Mailing List
> Subject: Re: AjaxTag 1.3 support?
>
> add:
>
> <param name="wrapWithComments">false</param>
>
> to the result. See the section "Wrap with Comments" here:
>
> http://cwiki.apache.org/S2PLUGINS/json-plugin.html
>
> musachy
>
> On Feb 5, 2008 12:58 PM, Griffith, Michael *
> <Michael.Griffith@(protected):
> > Musachy,
> >
> > I've looked over the documentation, and looked in the JSONWriter class
> > -- and it is not obvious to me how to configure this plugin setting.
> > How is it done?
> >
> > MG
> >
> > -----Original Message-----
> > From: Musachy Barroso [mailto:musachy@(protected)]
> > Sent: Tuesday, February 05, 2008 11:23 AM
> > To: Struts Users Mailing List
> >
> > Subject: Re: AjaxTag 1.3 support?
> >
> > Don't give up so easily :). That is just a setting on the json plugin
> > to prevent cross site scripting, and can be disabled.
> >
> > musachy
> >
> > On Feb 5, 2008 11:27 AM, Griffith, Michael *
> > <Michael.Griffith@(protected):
> > > Well, to answer my own question -- the answer is no. The JSON result
> > > serialization process escapes quotation marks, so my response that
> > > looked like this before serialization:
> > >
> > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > application?","440":"If your Java Application is an SE application
> > does
> > > it use Java Web Start?","450":"If your Java Application is a Java
> Web
> > > Application, list the application server used for
> > > production","490":"List any Java Web Services Technologies
> > > Used","500":"List any Java Web Application Technologies Used for
> > > presentation","510":"List any Java EE Technologies used in your
> > > application"}}
> > >
> > > Looks like this after serialization:
> > >
> > > "{\"questions\":{\"420\":\"Is your Java Application a ME, SE or EE
> > > application?\",\"440\":\"If your Java Application is an SE
> application
> > > does it use Java Web Start?\",\"450\":\"If your Java Application is
> a
> > > Java Web Application, list the application server used for
> > > production\",\"490\":\"List any Java Web Services Technologies
> > > Used\",\"500\":\"List any Java Web Application Technologies Used for
> > > presentation\",\"510\":\"List any Java EE Technologies used in your
> > > application\"}}"
> > >
> > > Making it unrecognizable to the autocompleter. This is pretty
> > > frustrating to me. Maybe I am expecting this to do something that it
> > was
> > > never designed to do. My end goal was to be able to evaluate the ID
> of
> > > the question that the user selected from the autocompleter.
> > >
> > > I'm giving up this path and looking elsewhere. Thanks to everyone
> > that
> > > replied to my question and tried to help me.
> > >
> > > MG
> > >
> > >
> > > -----Original Message-----
> > > From: Griffith, Michael * [mailto:Michael.Griffith@(protected)]
> > > Sent: Tuesday, February 05, 2008 8:32 AM
> > > To: Struts Users Mailing List
> > > Subject: RE: AjaxTag 1.3 support?
> > >
> > > Musachy,
> > >
> > > I can't seem to create the right blend of Entity objects/list/maps
> to
> > > allow the JSON plug in to serialize this response for me. If I
> create
> > > the string below using a loop, can I return it from the JSON plug in
> > > without the plug in doing anything further to it?
> > >
> > > In other words, does the plug in look at what it is trying to
> > serialize
> > > and say, "Hey this is already valid JSON, I don't need to do
> anything
> > to
> > > it..." or will it try to add additional info to the string returned?
> > >
> > > I'm guessing the shortest path for me is to just create the string
> in
> > my
> > > own serialization loop, but I don't want to confuse the plug in --
> if
> > > that makes any sense.
> > >
> > > MG
> > >
> > > -----Original Message-----
> > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > Sent: Monday, February 04, 2008 6:30 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: AjaxTag 1.3 support?
> > >
> > > Right on.
> > >
> > > On Feb 4, 2008 6:45 PM, Griffith, Michael *
> > > <Michael.Griffith@(protected):
> > > > Dave,
> > > >
> > > > I think the bigger problem is the JSON that is returned, while it
> > may
> > > be
> > > > valid, it not in the right structure expected. I should be
> > generating
> > > > JSON like this:
> > > >
> > > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > > application?","440":"If your Java Application is an SE application
> > > does
> > > > it use Java Web Start?"}}
> > > >
> > > > The [] brackets seem to be ignored by the parser.
> > > >
> > > > -----Original Message-----
> > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > > Sent: Monday, February 04, 2008 5:34 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: AjaxTag 1.3 support?
> > > >
> > > > ...
> > > >
> > > >
> > > > That's probably an issue.
> > > >
> > > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > > > Yea, I think so -- I copied and pasted this from the log
> > > > file/console...
> > > > >
> > > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > > >
> > > > > Is it generating those brackets around your JSON?
> > > > >
> > > > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > > >
> > > > > > Musachy,
> > > > > >
> > > > > > Thanks for your many replies... Does this JSON look like the
> > right
> > > > > > format? As far as I can tell, it matches your snippet below --
> > but
> > > I
> > > > > get
> > > > > > the same dojo parting error.
> > > > > >
> > > > > > [{"questions":{"420":"Is your Java Application a ME, SE or EE
> > > > > > application?"}},{"questions":{"440":"If your Java Application
> is
> > > an
> > > > SE
> > > > > > application does it use Java Web
> > Start?"}},{"questions":{"450":"If
> > > > > your
> > > > > > Java Application is a Java Web Application, list the
> application
> > > > > server
> > > > > > used for production"}}]
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > Sent: Monday, February 04, 2008 3:52 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > >
> > > > > > The rule to use a map (simplest one) was added on 2.1, on
> 2.0.x
> > > the
> > > > > > easiest way to generate the json is to have an object with a
> map
> > > > field
> > > > > > that matches the name of "dataFieldName" in the autocompleter
> > tag:
> > > > > >
> > > > > > class QuestionJson {
> > > > > >  private Map questions;
> > > > > >  ....
> > > > > > }
> > > > > >
> > > > > > public QuestionJson getQuestionJson() {
> > > > > >  Question q= ... [from my list]
> > > > > >   Map m = new HaswhMap();
> > > > > >   m.put("Key1", q.getQuestion1());
> > > > > >   m.put("Key2", q.getQuestion2());
> > > > > >   return new QuestionJson(m);
> > > > > > }
> > > > > >
> > > > > > <s:autocompleter ... dataFieldName="questions" ../>
> > > > > >
> > > > > > that will generate something like:
> > > > > >
> > > > > > {
> > > > > >  "questions": {
> > > > > >    "Key1" : "Question 1",
> > > > > >    "Key2" : "Question 2",
> > > > > >  }
> > > > > > }
> > > > > >
> > > > > > //that's the idea, but I typed out of what I remember which is
> > > often
> > > > > not
> > > > > > good :)
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On Feb 4, 2008 4:34 PM, Griffith, Michael *
> > > > > > <Michael.Griffith@(protected):
> > > > > > > Musachy,
> > > > > > >
> > > > > > > I'm still not getting it...
> > > > > > > I am now serializing a list of maps with the entity id and
> > text
> > > I
> > > > > > > want...
> > > > > > >
> > > > > > > Map<String,String> m= new HashMap<String,String>();
> > > > > > > Question q= ... [from my list]
> > > > > > > m.put("id", q.getId().toString());
> > > > > > > m.put("text", q.getText());
> > > > > > > newList.add(m);
> > > > > > >
> > > > > > > And my JSON result looks:
> > > > > > >
> > > > > > > [JSON][{"text":"Is your Java Application a ME, SE or EE
> > > > > > > application?","id":"420"},{"text":"If your Java Application
> is
> > > an
> > > > SE
> > > > > > > application does it use Java Web
> > Start?","id":"440"},{"text":"If
> > > > > your
> > > > > > > Java Application is a Java Web Application, list the
> > application
> > > > > > server
> > > > > > > used for production","id":"450"},{"text":"List any Java Web
> > > > Services
> > > > > > > Technologies Used","id":"490"},{"text":"List any Java Web
> > > > > Application
> > > > > > > Technologies Used for
> presentation","id":"500"},{"text":"List
> > > any
> > > > > Java
> > > > > > > EE Technologies used in your application","id":"510"}]
> > > > > > >
> > > > > > > I added the @JSON annotation as such:
> > > > > > >
> > > > > > >      @JSON(name="question")
> > > > > > >      public List<Map<String,String>> getNewList(){
> > > > > > >           return newList;
> > > > > > >      }
> > > > > > >
> > > > > > > But it appears to be ignored.
> > > > > > >
> > > > > > > MG
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > >
> > > > > > > Sent: Monday, February 04, 2008 2:53 PM
> > > > > > > To: Struts Users Mailing List
> > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > >
> > > > > > > Take a look here:
> > > > > > >
> > > > > > > http://cwiki.apache.org/S2PLUGINS/json-plugin.html
> > > > > > >
> > > > > > > musachy
> > > > > > >
> > > > > > > On Feb 4, 2008 3:43 PM, Griffith, Michael *
> > > > > > > <Michael.Griffith@(protected):
> > > > > > > > So, if you have an array of Entity objects, in my case
> > > question:
> > > > > > > >
> > > > > > > > How can I produce?
> > > > > > > > {
> > > > > > > >    "question" : [
> > > > > > > >       ["1","question 1 text..."],
> > > > > > > >       ["2","question 2 text..."]
> > > > > > > >
> > > > > > > >    ]
> > > > > > > > }
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > Sent: Monday, February 04, 2008 2:37 PM
> > > > > > > > To: Struts Users Mailing List
> > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > >
> > > > > > > > yes, but the output will depend on what you feed the JSON
> > > > result.
> > > > > > > >
> > > > > > > > musachy
> > > > > > > >
> > > > > > > > On Feb 4, 2008 3:20 PM, Griffith, Michael *
> > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > Musachy,
> > > > > > > > >
> > > > > > > > > I must have missed your point. Isn't the idea of using
> the
> > > > JSON
> > > > > > > > plug-in
> > > > > > > > > so you don't have to iterate and create the list? If I
> > have
> > > an
> > > > > > array
> > > > > > > > or
> > > > > > > > > Entity objects or maps, isn't there a way that the
> plug-in
> > > > will
> > > > > > > create
> > > > > > > > > the JSON specified below?
> > > > > > > > >
> > > > > > > > > MG
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > > Sent: Monday, February 04, 2008 1:56 PM
> > > > > > > > > To: Struts Users Mailing List
> > > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > to use the dataFIeldName, you have to return something
> > like:
> > > > > > > > >
> > > > > > > > > {
> > > > > > > > >   "state" : [
> > > > > > > > >      ["Alabama","AL"],
> > > > > > > > >      ["Alaska","AK"]
> > > > > > > > >   ]
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > if you are using 2.1 check this link:
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://cwiki.apache.org/WW/ajax-and-javascript-recipes.html#AjaxandJavaS
> > > > > > > > > criptRecipes-Autocompleter
> > > > > > > > >
> > > > > > > > > otherwise just an array of arrays should do:
> > > > > > > > >
> > > > > > > > > [
> > > > > > > > >   ["Alabama", "AL"],
> > > > > > > > >   ["Alaska", "AK"]
> > > > > > > > > ]
> > > > > > > > >
> > > > > > > > > musachy
> > > > > > > > >
> > > > > > > > > On Feb 4, 2008 2:46 PM, Griffith, Michael *
> > > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > > Musachy
> > > > > > > > > >
> > > > > > > > > > Here is the autocompleter tag and the JSON returned...
> > > > > > > > > >
> > > > >
> > > > === message truncated ===
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > > For additional commands, e-mail: user-help@(protected)
> > > >
> > > >
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > > For additional commands, e-mail: user-help@(protected)
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment: user_182279.ezm (zipped)
Musachy,

This is the actual response from the action when I invoke it from the
browser:

"{\"questions\":{\"420\":\"Is your Java Application a ME, SE or EE
application?\",\"440\":\"If your Java Application is an SE application
does it use Java Web Start?\",\"450\":\"If your Java Application is a
Java Web Application, list the application server used for
production\",\"490\":\"List any Java Web Services Technologies
Used\",\"500\":\"List any Java Web Application Technologies Used for
presentation\",\"510\":\"List any Java EE Technologies used in your
application\"}}"

I am building the JSON string and returning it from the action...
 private static final Character QUOTE= '"';
 private static final String DELIM= ":";
 private static final String COMMA=",";
 private static final String OPEN_BRACE="{";
 private static final String CLOSE_BRACE="}";
 
 StrinBuffer sb= new StringBuffer();
   StringBuffer sb= new StringBuffer();
 
sb.append(OPEN_BRACE).append(QUOTE).append("questions").append(QUOTE);
   sb.append(DELIM).append(OPEN_BRACE);
   for (Question question : list) {
 
sb.append(QUOTE).append(question.getId().toString()).append(QUOTE).appen
d(DELIM).append(QUOTE).append(question.getText()).append(QUOTE).append(C
OMMA);

}
...

The String actually looks like this before its serialized by the json
result:

{"questions":{"420":"Is your Java Application a ME, SE or EE
application?","440":"If your Java Application is an SE application does
it use Java Web Start?","450":"If your Java Application is a Java Web
Application, list the application server used for
production","490":"List any Java Web Services Technologies
Used","500":"List any Java Web Application Technologies Used for
presentation","510":"List any Java EE Technologies used in your
application"}}

-----Original Message-----
From: Musachy Barroso [mailto:musachy@(protected)]
Sent: Tuesday, February 05, 2008 1:20 PM
To: Struts Users Mailing List
Subject: Re: AjaxTag 1.3 support?

Oh I am sorry about that! (doh) Do you see the quoutes escaped in
firebug or something? As far as I remember the plugin doesnt escape
the quoutes. If you put the url in your browser you should see the
generated json as it actually is.

musachy

On Feb 5, 2008 2:12 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Musachy,
>
> Huh? That can't be right...
>
> First of all, the document says it wraps the JSON result in /* ... */
> comments, it doesn't say anything about escaping quotes.
>
> Second, the default value is false ;-) Adding this to the result
> configuration did nothing to my result. This seems like a bug.
>
> MG
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musachy@(protected)]
>
> Sent: Tuesday, February 05, 2008 12:14 PM
> To: Struts Users Mailing List
> Subject: Re: AjaxTag 1.3 support?
>
> add:
>
> <param name="wrapWithComments">false</param>
>
> to the result. See the section "Wrap with Comments" here:
>
> http://cwiki.apache.org/S2PLUGINS/json-plugin.html
>
> musachy
>
> On Feb 5, 2008 12:58 PM, Griffith, Michael *
> <Michael.Griffith@(protected):
> > Musachy,
> >
> > I've looked over the documentation, and looked in the JSONWriter
class
> > -- and it is not obvious to me how to configure this plugin setting.
> > How is it done?
> >
> > MG
> >
> > -----Original Message-----
> > From: Musachy Barroso [mailto:musachy@(protected)]
> > Sent: Tuesday, February 05, 2008 11:23 AM
> > To: Struts Users Mailing List
> >
> > Subject: Re: AjaxTag 1.3 support?
> >
> > Don't give up so easily :). That is just a setting on the json
plugin
> > to prevent cross site scripting, and can be disabled.
> >
> > musachy
> >
> > On Feb 5, 2008 11:27 AM, Griffith, Michael *
> > <Michael.Griffith@(protected):
> > > Well, to answer my own question -- the answer is no. The JSON
result
> > > serialization process escapes quotation marks, so my response that
> > > looked like this before serialization:
> > >
> > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > application?","440":"If your Java Application is an SE application
> > does
> > > it use Java Web Start?","450":"If your Java Application is a Java
> Web
> > > Application, list the application server used for
> > > production","490":"List any Java Web Services Technologies
> > > Used","500":"List any Java Web Application Technologies Used for
> > > presentation","510":"List any Java EE Technologies used in your
> > > application"}}
> > >
> > > Looks like this after serialization:
> > >
> > > "{\"questions\":{\"420\":\"Is your Java Application a ME, SE or EE
> > > application?\",\"440\":\"If your Java Application is an SE
> application
> > > does it use Java Web Start?\",\"450\":\"If your Java Application
is
> a
> > > Java Web Application, list the application server used for
> > > production\",\"490\":\"List any Java Web Services Technologies
> > > Used\",\"500\":\"List any Java Web Application Technologies Used
for
> > > presentation\",\"510\":\"List any Java EE Technologies used in
your
> > > application\"}}"
> > >
> > > Making it unrecognizable to the autocompleter. This is pretty
> > > frustrating to me. Maybe I am expecting this to do something that
it
> > was
> > > never designed to do. My end goal was to be able to evaluate the
ID
> of
> > > the question that the user selected from the autocompleter.
> > >
> > > I'm giving up this path and looking elsewhere. Thanks to everyone
> > that
> > > replied to my question and tried to help me.
> > >
> > > MG
> > >
> > >
> > > -----Original Message-----
> > > From: Griffith, Michael * [mailto:Michael.Griffith@(protected)]
> > > Sent: Tuesday, February 05, 2008 8:32 AM
> > > To: Struts Users Mailing List
> > > Subject: RE: AjaxTag 1.3 support?
> > >
> > > Musachy,
> > >
> > > I can't seem to create the right blend of Entity objects/list/maps
> to
> > > allow the JSON plug in to serialize this response for me. If I
> create
> > > the string below using a loop, can I return it from the JSON plug
in
> > > without the plug in doing anything further to it?
> > >
> > > In other words, does the plug in look at what it is trying to
> > serialize
> > > and say, "Hey this is already valid JSON, I don't need to do
> anything
> > to
> > > it..." or will it try to add additional info to the string
returned?
> > >
> > > I'm guessing the shortest path for me is to just create the string
> in
> > my
> > > own serialization loop, but I don't want to confuse the plug in --
> if
> > > that makes any sense.
> > >
> > > MG
> > >
> > > -----Original Message-----
> > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > Sent: Monday, February 04, 2008 6:30 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: AjaxTag 1.3 support?
> > >
> > > Right on.
> > >
> > > On Feb 4, 2008 6:45 PM, Griffith, Michael *
> > > <Michael.Griffith@(protected):
> > > > Dave,
> > > >
> > > > I think the bigger problem is the JSON that is returned, while
it
> > may
> > > be
> > > > valid, it not in the right structure expected. I should be
> > generating
> > > > JSON like this:
> > > >
> > > > {"questions":{"420":"Is your Java Application a ME, SE or EE
> > > > application?","440":"If your Java Application is an SE
application
> > > does
> > > > it use Java Web Start?"}}
> > > >
> > > > The [] brackets seem to be ignored by the parser.
> > > >
> > > > -----Original Message-----
> > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > > Sent: Monday, February 04, 2008 5:34 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: AjaxTag 1.3 support?
> > > >
> > > > ...
> > > >
> > > >
> > > > That's probably an issue.
> > > >
> > > > --- "Griffith, Michael *" <Michael.Griffith@(protected):
> > > > > Yea, I think so -- I copied and pasted this from the log
> > > > file/console...
> > > > >
> > > > > From: Dave Newton [mailto:newton.dave@(protected)]
> > > > >
> > > > > Is it generating those brackets around your JSON?
> > > > >
> > > > > --- "Griffith, Michael *" <Michael.Griffith@(protected)>
wrote:
> > > > >
> > > > > > Musachy,
> > > > > >
> > > > > > Thanks for your many replies... Does this JSON look like the
> > right
> > > > > > format? As far as I can tell, it matches your snippet below
--
> > but
> > > I
> > > > > get
> > > > > > the same dojo parting error.
> > > > > >
> > > > > > [{"questions":{"420":"Is your Java Application a ME, SE or
EE
> > > > > > application?"}},{"questions":{"440":"If your Java
Application
> is
> > > an
> > > > SE
> > > > > > application does it use Java Web
> > Start?"}},{"questions":{"450":"If
> > > > > your
> > > > > > Java Application is a Java Web Application, list the
> application
> > > > > server
> > > > > > used for production"}}]
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > Sent: Monday, February 04, 2008 3:52 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > >
> > > > > > The rule to use a map (simplest one) was added on 2.1, on
> 2.0.x
> > > the
> > > > > > easiest way to generate the json is to have an object with a
> map
> > > > field
> > > > > > that matches the name of "dataFieldName" in the
autocompleter
> > tag:
> > > > > >
> > > > > > class QuestionJson {
> > > > > >  private Map questions;
> > > > > >  ....
> > > > > > }
> > > > > >
> > > > > > public QuestionJson getQuestionJson() {
> > > > > >  Question q= ... [from my list]
> > > > > >   Map m = new HaswhMap();
> > > > > >   m.put("Key1", q.getQuestion1());
> > > > > >   m.put("Key2", q.getQuestion2());
> > > > > >   return new QuestionJson(m);
> > > > > > }
> > > > > >
> > > > > > <s:autocompleter ... dataFieldName="questions" ../>
> > > > > >
> > > > > > that will generate something like:
> > > > > >
> > > > > > {
> > > > > >  "questions": {
> > > > > >    "Key1" : "Question 1",
> > > > > >    "Key2" : "Question 2",
> > > > > >  }
> > > > > > }
> > > > > >
> > > > > > //that's the idea, but I typed out of what I remember which
is
> > > often
> > > > > not
> > > > > > good :)
> > > > > >
> > > > > > musachy
> > > > > >
> > > > > > On Feb 4, 2008 4:34 PM, Griffith, Michael *
> > > > > > <Michael.Griffith@(protected):
> > > > > > > Musachy,
> > > > > > >
> > > > > > > I'm still not getting it...
> > > > > > > I am now serializing a list of maps with the entity id and
> > text
> > > I
> > > > > > > want...
> > > > > > >
> > > > > > > Map<String,String> m= new HashMap<String,String>();
> > > > > > > Question q= ... [from my list]
> > > > > > > m.put("id", q.getId().toString());
> > > > > > > m.put("text", q.getText());
> > > > > > > newList.add(m);
> > > > > > >
> > > > > > > And my JSON result looks:
> > > > > > >
> > > > > > > [JSON][{"text":"Is your Java Application a ME, SE or EE
> > > > > > > application?","id":"420"},{"text":"If your Java
Application
> is
> > > an
> > > > SE
> > > > > > > application does it use Java Web
> > Start?","id":"440"},{"text":"If
> > > > > your
> > > > > > > Java Application is a Java Web Application, list the
> > application
> > > > > > server
> > > > > > > used for production","id":"450"},{"text":"List any Java
Web
> > > > Services
> > > > > > > Technologies Used","id":"490"},{"text":"List any Java Web
> > > > > Application
> > > > > > > Technologies Used for
> presentation","id":"500"},{"text":"List
> > > any
> > > > > Java
> > > > > > > EE Technologies used in your application","id":"510"}]
> > > > > > >
> > > > > > > I added the @JSON annotation as such:
> > > > > > >
> > > > > > >      @JSON(name="question")
> > > > > > >      public List<Map<String,String>> getNewList(){
> > > > > > >           return newList;
> > > > > > >      }
> > > > > > >
> > > > > > > But it appears to be ignored.
> > > > > > >
> > > > > > > MG
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > >
> > > > > > > Sent: Monday, February 04, 2008 2:53 PM
> > > > > > > To: Struts Users Mailing List
> > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > >
> > > > > > > Take a look here:
> > > > > > >
> > > > > > > http://cwiki.apache.org/S2PLUGINS/json-plugin.html
> > > > > > >
> > > > > > > musachy
> > > > > > >
> > > > > > > On Feb 4, 2008 3:43 PM, Griffith, Michael *
> > > > > > > <Michael.Griffith@(protected):
> > > > > > > > So, if you have an array of Entity objects, in my case
> > > question:
> > > > > > > >
> > > > > > > > How can I produce?
> > > > > > > > {
> > > > > > > >    "question" : [
> > > > > > > >       ["1","question 1 text..."],
> > > > > > > >       ["2","question 2 text..."]
> > > > > > > >
> > > > > > > >    ]
> > > > > > > > }
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > Sent: Monday, February 04, 2008 2:37 PM
> > > > > > > > To: Struts Users Mailing List
> > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > >
> > > > > > > > yes, but the output will depend on what you feed the
JSON
> > > > result.
> > > > > > > >
> > > > > > > > musachy
> > > > > > > >
> > > > > > > > On Feb 4, 2008 3:20 PM, Griffith, Michael *
> > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > Musachy,
> > > > > > > > >
> > > > > > > > > I must have missed your point. Isn't the idea of using
> the
> > > > JSON
> > > > > > > > plug-in
> > > > > > > > > so you don't have to iterate and create the list? If I
> > have
> > > an
> > > > > > array
> > > > > > > > or
> > > > > > > > > Entity objects or maps, isn't there a way that the
> plug-in
> > > > will
> > > > > > > create
> > > > > > > > > the JSON specified below?
> > > > > > > > >
> > > > > > > > > MG
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Musachy Barroso [mailto:musachy@(protected)]
> > > > > > > > > Sent: Monday, February 04, 2008 1:56 PM
> > > > > > > > > To: Struts Users Mailing List
> > > > > > > > > Subject: Re: AjaxTag 1.3 support?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > to use the dataFIeldName, you have to return something
> > like:
> > > > > > > > >
> > > > > > > > > {
> > > > > > > > >   "state" : [
> > > > > > > > >      ["Alabama","AL"],
> > > > > > > > >      ["Alaska","AK"]
> > > > > > > > >   ]
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > if you are using 2.1 check this link:
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
http://cwiki.apache.org/WW/ajax-and-javascript-recipes.html#AjaxandJavaS
> > > > > > > > > criptRecipes-Autocompleter
> > > > > > > > >
> > > > > > > > > otherwise just an array of arrays should do:
> > > > > > > > >
> > > > > > > > > [
> > > > > > > > >   ["Alabama", "AL"],
> > > > > > > > >   ["Alaska", "AK"]
> > > > > > > > > ]
> > > > > > > > >
> > > > > > > > > musachy
> > > > > > > > >
> > > > > > > > > On Feb 4, 2008 2:46 PM, Griffith, Michael *
> > > > > > > > > <Michael.Griffith@(protected):
> > > > > > > > > > Musachy
> > > > > > > > > >
> > > > > > > > > > Here is the autocompleter tag and the JSON
returned...
> > > > > > > > > >
> > > > >
> > > > === message truncated ===
> > > >
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > > For additional commands, e-mail: user-help@(protected)
> > > >
> > > >
> > > >
> > > >
> > > >
> >
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > > For additional commands, e-mail: user-help@(protected)
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)




Attachment: user_182275.ezm (zipped)
Tommy Becker wrote:
> I have a question about using OGNL PropertyAccessors. We have an object
> on the value stack that we expose to JSP pages that does not have
> standard JavaBeans getter/setter methods. From what I can tell, this
> leaves us 2 options. We can either call the getter methods explicitly
> via OGNL method calls in the pages, or we can wrap the object in a
> JavaBean-like object. The second option is unworkable in all but the
> simplest of cases when you realize that the method calls can themselves
> return another object that needs to be wrapped, or even a collection of
> them. So we've been using method calls in the pages (yeah I know).
>
> Reading through the OGNL docs, it seems that what we need is a
> PropertyAccessor that knows how to operate on our object. So we
> implemented one, and attempted to register it by placing this in our
> struts.xml:
>
> <bean type="ognl.PropertyAccessor" name="class.we.need.access.to"
> class="our.property.accessor.PropertyAccessor"/>
>
> Unfortunately it doesn't work. Can someone tell me what we're doing
> wrong, or even if what we're trying to do is possible? Thanks!

I don't know anything about OGNL's PropertyAccessor, but I doubt anyone
can offer much help without seeing the code and a better description of
the failure than "it doesn't work."

L.


Attachment: user_182276.ezm (zipped)

Hi everyone, I'm having trouble with a jsp that has two independent forms,
which are separated with tabs. For some reason when i submit the second
form I get an error saying "javax.servlet.jsp.JspException: Cannot find bean
under name roleList", roleList is a component in the first form. Each form
has its own Action Form Bean and Action class.
Here is my jsp:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet"
href="<%=request.getContextPath()%>/stylesheets/application.css"
type="text/css">
    <title>HARPS User Management</title>
   
    <tab:tabConfig />
  </head>
  <body>

  <tab:tabContainer id="role-management">
    <tab:tabPane id="roleAssignment" tabTitle="Assign Roles">
       <h1> Add Users to a Role </h1>
       <html:form action="/LoadUsers.do">
          <html:hidden property="command" value="initial"/>
          <table>
            <tr>
               <td>Roles:</td>
               <td>Current Users in Role:</td>
               <td>All HARPS Users:</td>
            </tr>
            <tr>
               <td>
                  <html:select property="rolesList_id"
multiple="false" size="10" onclick="submit()">
                    <html:options collection="roleList"
property="value" labelProperty="label"/>
                  </html:select>
               </td>
               <td>
                  <html:select property="userRoleList_id"
multiple="true" size="10">
                    <html:options collection="userRoleList"
property="value" labelProperty="label"/>
                  </html:select>
               </td>
               <td>        
                  <html:select property="userList_id"
multiple="true" size="10">
                    <html:options collection="userList"
property="value" labelProperty="label"/>
                  </html:select>
               </td>
            </tr>
            <tr>
               <td></td>
               <td align="center"><html:button
property="removeUser" value=">> Remove User"
onclick="command.value='remove';submit()"/></td>
               <td align="center"><html:button property="addUser"
value="<< Add User" onclick="command.value='addUser';submit()"/></td>
            </tr>
          </table>
        </html:form>
    </tab:tabPane>
   
    <tab:tabPane id="createRole" tabTitle="Create New Role">
       <h1> Create a New Role </h1>
       <html:form action="/CreateRole.do">
          <table>
            <tr>
               <td><bean:message key="role.name"/> </td>
               <td><html:text property="roleName"/></td>
               <td></td>
            </tr>
            <tr>
               <td><bean:message key="role.description"/></td>
               <td><html:textarea property="roleDescription"
rows="4"/></td>
               <td>
                  <table>
                    <tr>
                       <td><html:checkbox property="jta"/></td>
                       <td><bean:message
key="jta.checkbox"/></td>
                    </tr>
                    <tr>
                       <td><html:checkbox
property="ntsp"/></td>
                       <td><bean:message
key="ntsp.checkbox"/></td>
                    </tr>
                    <tr>
                       <td><html:checkbox property="ia"/></td>
                       <td><bean:message
key="ia.checkbox"/></td>
                    </tr>
                  </table>
               </td>
            </tr>
            <tr>
               <td><html:submit value="Submit"/></td>
               <td></td>  
            </tr>
          </table>
         
       </html:form>
    </tab:tabPane>
  </tab:tabContainer>
 
  </body>
</html>

When I submit the form it is going to the correct Action class (I can see
output from hitting the class), but it seems to fail when reloading the
page. Is it maybe looking for roleList data when reloading the page? Any
suggestions would be greatly appreciated!!!

-- Shanna --
--
Sent from the Struts - User mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.