Don't know, I was trying to initialize the variable using the same action
that would be used to update it.  And, because of this problem, I haven't
been able to initialize it.  Maybe I'll give it a try later.
  (*Chris*)

On Tue, Jul 14, 2009 at 7:49 AM, Musachy Barroso <musa...@gmail.com> wrote:

> Never thought of this use case before. Does it work if you use the
> action directly, instead of calling from a jsp?
>
> musachy
>
> On Mon, Jul 13, 2009 at 11:17 PM, Chris Pratt<thechrispr...@gmail.com>
> wrote:
> > I'm having a problem using <s:action executeResult="true"> with an action
> > whose result type is json.  It doesn't insert the results.  My Action is
> > something like:
> >
> > public class InitCalendarAction {
> >  private List<List<String>> json;
> >
> >  /**
> >   * Get the JSON Object to be Serialized
> >   *
> >   * @return JSON Object
> >   */
> >  public Object getJson () {
> >    return json;
> >  } //getJson
> >
> >  /**
> >   * Prepare the Object to be Serialized using JSON
> >   *
> >   * @return "success";
> >   */
> >  public String execute () {
> >    Category cat;
> >    Category[] daily = user.getPlan().getDailyCategories();
> >    Calendar cal = Calendar.getInstance();
> >    cal.set(Calendar.DATE,1);
> >    int first = cal.get(Calendar.DAY_OF_WEEK) - 1;
> >    List<String> row;
> >    json = new ArrayList<List<String>>();
> >    for(int day = 1;day <= cal.getMaximum(Calendar.DATE);day++) {
> >      row = new ArrayList<String>();
> >      row.add("true");
> >      cat = daily[(day + first) % 7];
> >      row.add(cat.name().toLowerCase());
> >      row.add(cat.name());
> >      json.add(row);
> >    }
> >    return "success";
> >  } //execute
> >
> > } //*InitCalendarAction
> >
> > I have the action defined as:
> >
> >    <action name="init-calendar" class="initCalendarAction">
> >      <result type="json">
> >        <param name="root">json</param>
> >      </result>
> >    </action>
> >
> > In my JSP, I have:
> >
> >    var hilights = "<s:action name='init-calendar' namespace='/'
> > executeResult='/'/>";
> >
> > But instead of the expected:
> >
> >    var hilights = "[ [ "true", "cardio", "Cardio"], [ "true",
> "upperbody",
> > "Upper Body"] ... ]";
> >
> > I get:
> >    var hilights = "";
> >
> > There are no errors in the logs and when I write out each row in the
> array,
> > everything is there as expected, but there's just no output.  Any idea's
> > why?
> >  (*Chris*)
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to