title: Working with Stripes, Javascript and Ajax
body: <p>This is my jsp page (which is a modal page to another jsp page ) which contains a table, a form, a javascript and ajax .</p>
  
  <pre><code>&lt;%@ include file="/WEB-INF/includes/taglibs.jsp" %&gt;
  &lt;script type="text/javascript"
          src="${pageContext.request.contextPath}/ajax/prototype.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" xml:space="preserve"&gt;
  
  function invoke(form, event, container) {        
          var params = Form.serialize(form, {submit:event});
          new Ajax.Updater(container, form.action, {method:'post', parameters:params});
      }
  &lt;/script&gt;
  
  &lt;display:table name="actionBean.currentAidApplicantYear.comments" id="result" class="maui"&gt;
      &lt;display:column property="lastUpdatedBy" title="Last Updated By" sortable="true"/&gt;
      &lt;display:column property="lastUpdatedTimestamp" title="Last Updated Date"
                      format="{0,date,MM/dd/yyyy HH:mm}" sortable="true"/&gt;
      &lt;display:column property="comment" title="Memo"/&gt;
  &lt;/display:table&gt;
  &lt;div class="actionBar" style="margin-top: 20px; text-align: center;"&gt;
      &lt;stripes:form beanclass="${actionBean.class}" id="addMemoForm" method="POST"&gt;
                  &lt;tags:labelAndValue label="Comment" name="comment" &gt;
                      &lt;stripes:textarea id="commentTextArea" name="comment.comment" cols="75"/&gt;
                  &lt;/tags:labelAndValue&gt;
          &lt;stripes:submit name="saveCommentAjax" value="Add Memo"
                          onclick="invoke(this.form, this.name, 'result');"/&gt;
          &lt;stripes:hidden name="id" /&gt;        
      &lt;/stripes:form&gt;  
  &lt;/div&gt;
  </code></pre>
  
  <p>And this is part of the action bean which extends another class which in turn implements ActionBean, ValidationErrorHandler </p>
  
  <pre><code>Public class  CommentsTab extends AbstractAidApplicantTab {
  private AidApplicantYearComment comment;
  
      public AidApplicantYearComment getComment() {
          return comment;
      }
      public void setComment(AidApplicantYearComment comment) {
          this.comment = comment;
      }
  public Resolution saveCommentAjax(){
                      String result = String.valueOf(comment.getComment());
                      comment.save();//build up the comment object 
  //by this time the comment object will save the string comment, user who updates it and a //time stamp. Those are the three variables that are displayed on the jsp table.
          return new StreamingResolution("text/html",new StringReader(result));}
  //here instead of returning just a string “result” I prefer to return a comment object or //the three values I wanted to display on a table. How can I do that?
  </code></pre>
  
  <p>When the submit button is clicked I use an ajax to call an action bean’s method to do some operation and the function returns a streaming resolution <strong>(StreamingResolution("text/html",new StringReader(result));)</strong>.  Once I get the response I wanted to refresh the table without refreshing the page. However, in order to do that I have to get an object (<strong>a comment object)</strong> from the response not a text (or may be an array of Strings which might contain the values of the object)</p>
  
  <p>Any help would be appreciated. Thank you</p>