Use an ASP file to call Servlet

Source: Internet
Author: User
Tags websphere application server
ASP on the WebSphere Application Server supports ActiveX Control embedded in Servlet. The following describes the methods and attributes of ActiveX control over AspToServlet.
This method is described as follows:

(1) String ExecServletToString (String servletName); execute ServletName and return its output to a String.

(2) ExecServlet (String servletName); execute ServletName and send its output directly to the HTML page.

(3) String VarValue (String varName); get a preset variable value (other formats ).

(4) VarValue (String varName, String newVal); set the variable value. The total size of a variable must be less than 0.5 characters
Section (Kbyte ). And only use these variables for the configuration file.
Its Attributes are as follows:
= Boolean WriteHeaders; if this attribute is true, the title provided by the Servlet is written to the user. The default value is false.
= Boolean OnTest; if this attribute is true, the server records the message to the generated HTML page. The default value is false.
The following ASP script example is written in Microsoft Visual Basic Scripting (VBScript.
<%
'Small sample asp file to show the capabilities of the servlets and the ASP GateWay...
%>
<H1> Starting the ASP-> Java Servlet demo </H1>
<%
'Create a Servlet gateway object and initialize it...
Set javaasp = Server. CreateObject ("AspToServlet. AspToServlet ")
'Setting these properties is only for the sake of demo.
'These are the default values...
Javaasp. OnTest = False
Javaasp. WriteHeaders = False
'Add several variables...
Javaasp. VarValue ("gal") = "lag"
Javaasp. VarValue ("pico") = "ocip"
Javaasp. VarValue ("tal") = "lat"
Javaasp. VarValue ("paz") = "zap"
Javaasp. VarValue ("variable name with spaces") = "variable value with spaces"
%>
<BR>
Lets check the variables
<%
Response. Write ("variable gal = ")
Response. Write (javaasp. VarValue ("gal "))
%>
<BR>
<%
Response. Write ("variable pico =" & javaasp. VarValue ("pico "))
%>

<BR>
<HR>
<%
Galout = javaasp. ExecServletToString ("SnoopServlet ")
If javaasp. WriteHeaders = True Then
%>
Headers were written <%
Else
%>
Headers were not written <%
End If
Response. Write (galout)
%>
<H1> The End... </H1>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.