个人资料
  • 博客访问:
正文

EzyMuveeInfo Project Update (5)

(2007-12-06 13:55:06) 下一个
Since the last update, I have impletmented POPUNDER.

The next move is to simulate HTML form submission via Java. The challenge here is how to obtain the session from the web site after I first submit username and password. Once this passes, there will be no technical problem.

One of the key point for the project is to automate all processes.

Reference Links:
http://www.innovation.ch/java/HTTPClient/emulating_forms.html

http://www.nabble.com/AW:-Form-submit---validate---display-error-message---cycle--%3E-what--is-the-recommended-way-to-implement-this--t4739848.html
Pondering your (both) input, I like very much your idea of an
encapsulated object holding all data which is either captured from the
submitted form data or - if no form data have been posted - retrieved
from the model data (in my case, via Torque from the database).

So, the base class of such a form data storage would something like:

public abstract class FormData {

  /** populate with data from the HTTP request (submitted data) */
  public abstract void captureRequestParameters(RunData data);

  /** retrieve data from the business model */
  public abstract void retrieve();

  /** persists data into the business model */
  public abstract void save();

  /**
   * validate data, typically after capturing data from HTTP request
   *
   * @return flag: true ... data ok; false ... validation error
   */
  public abstract boolean isValid();

  /** one-in-all method */
  public void doSubmitAction(RunData data) {

    this.captureRequestParameters(data);
    if (this.isValid()) {
      this.save();
    }
  }
}

For each editable HTML form I would derive a concrete class from
FormData holding the specific form data needed.

I think I got the basic points, thank you both for your detailed
responses.

[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.