$Web: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
{{DISPLAYTITLE:$Web}}
{{DISPLAYTITLE:$Web}}
<span class="pageSubtitle"><section begin="desc" />Determine whether running a web request<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Determine whether running a web request<section end="desc" /></span>
:ih1 id=webfunc.Web Server $functions


$Web indicates whether the current processing is the result of a request to ''[[Janus Web Server]]''.
$Web indicates whether the current processing is the result of a request to ''[[Janus Web Server]]''.
Line 8: Line 6:
<p class="syntax"><section begin="syntax" /> %RC = $Web
<p class="syntax"><section begin="syntax" /> %RC = $Web
<section end="syntax" /></p>
<section end="syntax" /></p>


$Web takes no arguments and returns either a 0 or a 1.
$Web takes no arguments and returns either a 0 or a 1.
Line 21: Line 18:
</table>
</table>
<p class="caption">$WEB return codes</p>
<p class="caption">$WEB return codes</p>


The $Web function is most useful for preventing code that should only be run for a web request from running for 3270 (or other non-web) requests and for ensuring that non-web, possibly 3270 specific code is not run for web requests.
The $Web function is most useful for preventing code that should only be run for a web request from running for 3270 (or other non-web) requests and for ensuring that non-web, possibly 3270 specific code is not run for web requests.
Line 31: Line 27:
</p>
</p>


In this example, the variable %DISTRICT is set from a form field when running a web request and from a screen field otherwise. $Web has several advantages over other techniques for determining whether a request is running a web request such as checking $Web_Port or doing a $VIEW('IODEV'):


In this example, the variable %DISTRICT is set from a form field when running a web request and from a screen field otherwise. $Web has several advantages over other techniques for determining whether a request is running a web request such as checking $Web_Port or doing a $VIEW('IODEV'):
<ol>
<ol>
<li>It is syntactically simple and easy to understand.  
<li>It is syntactically simple and easy to understand.  
<li>It works correctly even when a request is being debugged using JANUSDEBUG.  
<li>It works correctly even when a request is being debugged using JANUSDEBUG.  
<li>It works correctly and does not cause a "CONNECTION WAS LOST" user restart after the connection was closed either with a $Web_Done or by the browser. This can be especially useful if there is web-specific processing, like APSY navigation code, that happens after a $Web_Done.
<li>It works correctly and does not cause a "CONNECTION WAS LOST" user restart after the connection was closed either with a $Web_Done or by the browser. This can be especially useful if there is web-specific processing, like APSY navigation code, that happens after a $Web_Done.
</ol>
</ol>


[[Category:Janus Web Server $functions|$Web]]
[[Category:Janus Web Server $functions|$Web]]

Revision as of 20:18, 22 February 2011

<section begin="desc" />Determine whether running a web request<section end="desc" />

$Web indicates whether the current processing is the result of a request to Janus Web Server.

Syntax

<section begin="syntax" /> %RC = $Web <section end="syntax" />

$Web takes no arguments and returns either a 0 or a 1.

Code Meaning
0 Not running a web request.
1 Running a web request.

$WEB return codes

The $Web function is most useful for preventing code that should only be run for a web request from running for 3270 (or other non-web) requests and for ensuring that non-web, possibly 3270 specific code is not run for web requests.

IF $Web THEN %DISTRICT = $Web_Form_Parm('DISTRICT') ELSE %DISTRICT = %QUERY:DISTRICT END IF

In this example, the variable %DISTRICT is set from a form field when running a web request and from a screen field otherwise. $Web has several advantages over other techniques for determining whether a request is running a web request such as checking $Web_Port or doing a $VIEW('IODEV'):

  1. It is syntactically simple and easy to understand.
  2. It works correctly even when a request is being debugged using JANUSDEBUG.
  3. It works correctly and does not cause a "CONNECTION WAS LOST" user restart after the connection was closed either with a $Web_Done or by the browser. This can be especially useful if there is web-specific processing, like APSY navigation code, that happens after a $Web_Done.