Argh. I just tested the this.getPage(), and although it worked at some point, it doesn't work now - I apologize. We need portable URLs, but we were looking for a method requiring less maintenance. Thanks, again for the response.

Ryan

On Aug 12, 2008, at 2:29 PM, Johan Compagner wrote:

how would setPage(this.getPage()) then work???
If you want those kind of urls with state in the urls you have to create a
PageParameter object
you can reuse existing or tweak an existing or create a new one

Or do you just want nice urls that dont have to work when there is no
session?
use Hybridurlencoder to mound the page then you can do setPage()


johan


On Tue, Aug 12, 2008 at 6:31 PM, Ryan O'Hara <[EMAIL PROTECTED]> wrote:

Thank for the response, Johan. I don't think this is what we're looking
for, however.  If the user changes a form parameter, it will not be
reflected in the old page parameters.  Any other ideas?

Thanks,
Ryan


On Aug 12, 2008, at 8:34 AM, Johan Compagner wrote:

 call super(parameters) in the page constructor
then getPage().getParameters() should have the parameter map

johan


On Mon, Aug 11, 2008 at 5:51 PM, Ryan O'Hara <[EMAIL PROTECTED]>
wrote:

 We are trying to figure out the best way to make our URLs portable.
Currently, we mount a QueryStringUrlEncodingStrategy in our application class. Then, in the beginning of the page's constructor, page parameters are mapped to instance variables. Then, when the form button is clicked,
a
map of parameters is created to pass to setResponsePage(Class,
PageParameters). It seems like mapping the parameters to variables and creating a map of parameters to setResponsePage() can be avoided by using setResponsePage(this.getPage()), but the URL produced is not portable. Having to map parameters to instance variables and maintain a map to
pass
in is high maintenance. Is there a better way to do this? Thanks for
the
help.

Ryan

public Search(PageParameters params) {
      //TODO:
      //it would be nice if this could be done automatically...
      //if there are parameters, map them to instance variables
      if (params.size() > 0) {
          setSourceSelection(params.getString("source"));
          setPosition(params.getString("position"));
          setSizeStart(params.getString("sizeStart"));
          setSizeEnd(params.getString("sizeEnd"));
          setSnpStart(params.getString("snpStart"));
          setSnpEnd(params.getString("snpEnd"));
          setSortorderSelection(params.getString("sortorder"));
setVariationTypeSelection(params.getString ("variationType"));

          if (params.getInt("pagesize", -1) != -1) {
              setPagesize(params.getInt("pagesize"));
          }

          //populate the result list now that the instance
          //variables have been set
          try {
              resultlist =
annotatedQuery.getAnnotations(getSourceSelection(), getPosition(),
getSizeStart(), getSizeEnd(), getSnpStart(), getSnpEnd(),
getSortorderSelection(), getVariationTypeSelection());
          } catch (CnvException e) {
              e.printStackTrace();
              error(e.getMessage());
          }
      }

//submit button
      Button asl = new Button("submit") {
          public void onSubmit() {
              try {
                  //TODO:
                  //it would be nice if we could make the url of
                  //setresponsepage(this.getPage()) to look nice
//as it would handle all of the parameter business..
ugh
                  HashMap params = new HashMap<String, String>();
                  params.put("source", getSourceSelection());
                  params.put("position", getPosition());
                  params.put("sortorder", getSortorderSelection());
                  params.put("variationType",
getVariationTypeSelection());
                  if (getSizeStart() != null) {
                      params.put("sizeStart", getSizeStart());
                  }
                  if (getSizeEnd() != null) {
                      params.put("sizeEnd", getSizeEnd());
                  }
                  if (getSnpStart() != null) {
                      params.put("snpStart", getSnpStart());
                  }
                  if (getSnpEnd() != null) {
                      params.put("snpEnd", getSnpEnd());
                  }
setPagesize((Integer) results_page.getModelObject());
                  params.put("pagesize", getPagesize().toString());

                  System.out.println(getSortorderSelection());
                  setResponsePage(Search.class, new
PageParameters(params));
              } catch (Exception e) {
                  error(e.getMessage());
              }
          }
      };

------------------------------------------------------------------- --
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to