#### Example 2: Sending a large report set result by e-mail upon finishing

Here two ways are provided to publish a large report set result via URL: JSP and servlet. Take the following examples to publish a large report set result by e-mail and to customize the message displayed in the web browser.

- JSP parameter specification

  jrs.catalog=%2fcatalog path%2fcatalog name
  jrs.report=%2freport set path%2freport set name
  jrs.timeout_send_email=true/[false]
  jrs.report_timeout=number (if timeout >number and jrs.timeout_send_email=true, send mail)
  jrs.mailto=mail address
  jrs.mailsubject=mail subject
  jrs.result_type=1 (HTML) or 2(PDF) or 3(Text) or 4(Excel) or 5(PostScript) or 6(Rich Text) or 7(XML)
  jrs.mailcomments=mail content
  jrs.mailfrom=mail address of sender
  jrs.timeout_sendmail_message=the message which you customize

  There are two server JSPs for running a report set:

  - tryView.jsp
    This is the normal method of accessing report sets using URLs. If the report set has parameters and the parameters provided in the URL fail to include all necessary parameters, the Enter Parameter Values dialog will be shown for you to specify parameters, otherwise it will directly go to runReport.jsp. For more, see Specifying parameters using dialog when running report sets via URL.
  - runReport.jsp
    The runReport.jsp functions the same as tryView.jsp when the report set has no parameter. When it has parameters, the report set runs with the default parameters if no parameter is specified, or else it runs with the parameters specified in the URL.

  When you use tryView.jsp to run a report set without a parameter:

      http://localhost:8888/jinfonet/tryView.jsp?jrs.cmd=jrs.try_vw
      &jrs.catalog=%2fSampleReports%2fSampleReports.cat
      &jrs.report=%2fSampleReports%2fEmployeeInformation.cls
      &jrs.timeout_send_email=true
      &jrs.report_timeout=5
      &jrs.mailto=support@jinfonet.com
      &jrs.mailsubject=TaskForTimeoutSendEmail&jrs.result_type=1
      &jrs.mailcomments=IFTHEREPORTISFINISHEDTHERESULTWILLBESENT
      &jrs.mailfrom=Mike@jinfonet.com

  When you use runReport.jsp to run a report set with parameters:

      http://localhost:8888/jinfonet/runReport.jsp?jrs.cmd=jrs.web_vw
      &jrs.catalog=%2fSampleReports%2fSampleReports.cat
      &jrs.report=%2fSampleReports%2fCustomerAnalysis.cls
      &jrs.param$P_StartDate=01/01/2006&jrs.param$p_EndDate=12/31/2007
      &jrs.timeout_send_email=true&jrs.report_timeout=1
      &jrs.mailto=support@jinfonet.com&jrs.mailsubject=AboutTaskForTimeout
      &jrs.result_type=1

- Servlet parameter specification

  jrs.cmd=jrs.try_vw (when the report set has no parameter)
  jrs.cmd=jrs.web_vw (when the report set has parameter)
  jrs.timeout_send_email=true/[false]
  jrs.report_timeout=number (if timeout >number and jrs.timeout_send_email=true, send mail)
  jrs.mailto=mail address
  jrs.mailsubject=mail subject
  jrs.result_type=1 (HTML) or 2(PDF) or 3(Text) or 4(Excel) or 5(PostScript) or 6(Rich Text) or 7(XML)
  jrs.mailcomments=mail content
  jrs.mailfrom=mail address of the sender
  jrs.timeout_sendmail_message=the message that you can customize

  When you use a servlet to run a report set without a parameter:

      http://localhost:8888/jrserver/SampleReports/SampleReports.cat/
      EmployeeInformation.cls?jrs.cmd=jrs.try_vw
      &jrs.timeout_send_email=true&jrs.report_timeout=1
      &jrs.mailto=support@jinfonet.com
      &jrs.mailsubject=AboutTaskForTimeoutSendEmail&jrs.result_type=1
      &jrs.mailcomments=COUNTRECORDSPERPAGE

  When you use a servlet to run a report set with a parameter:

      http://localhost:8888/jrserver/SampleReports/SampleReports.cat/
      CustomerAnalysis.cls?jrs.cmd=jrs.web_vw
      &jrs.param$P_StartDate=01/01/2006&jrs.param$p_EndDate=12/31/2007
      &jrs.timeout_send_email=true&jrs.report_timeout=1
      &jrs.mailto=support@jinfonet.com
      &jrs.mailsubject=TaskForTimeoutEmail
      &jrs.result_type=1&jrs.mailcomments=CUSTOMERORDER

- Customize your message to be displayed in the web browser

  You can set a message by setting the parameter jrs.timeout_sendmail_message.

  For example, you want to display message as below:

  Running <report name> takes more than <Timeout> seconds.
  The subject is <mail subject> and has been sent to <mailto> from <mailfrom>
  It is a file whose type is <type>.

  Then you can set the parameter in URL:

  jrs.timeout_sendmail_message=Running {6} takes more than {0} seconds.<p>The subject is {2} and has been sent to {1} from {5}.<p>It is a file whose type is {3}.

  Where

  {0} - The report set timeout
  {1} - mail to
  {2} - mail subject
  {3} - result type
  {4} - mail comment
  {5} - mail from
  {6} - Catalog name/report set
  <p> - an Enter key

  Example

      http://localhost:8888/jrserver/SampleReports/SampleReports.cat/
      CustomerAnalysis.cls?jrs.cmd=jrs.web_vw
      &jrs.param$P_StartDate=01/01/2006&jrs.param$p_EndDate=12/31/2007
      &jrs.timeout_send_email=true&jrs.report_timeout=1
      &jrs.mailto=support@jinfonet.com
      &jrs.mailsubject=AboutTaskForTimeoutSendEmail
      &jrs.result_type=1&jrs.mailcomments=CustomerAnalysis
      &jrs.mailfrom=support@jinfonet.com&jrs.timeout_sendmail_message=...

  This {6} is a large report set whose runtime is over {0} seconds.<p>The report was sent to {1} from {5}.<p>The subject of the mail is {2}.<p>Its type is {3}.

  Note: You should type the sign " ' " twice if you use it in the message.