Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Running Servlets On ColdFusion

DZone's Guide to

Running Servlets On ColdFusion

· Java Zone
Free Resource

Just released, a free O’Reilly book on Reactive Microsystems: The Evolution of Microservices at Scale. Brought to you in partnership with Lightbend.

ColdFusion Technical Support Engineer Vikas Chandran explains how to run Java servlets on ColdFusion.

TO TEST

-Create a cfm page and call the Servlet [in our case the servlet name is "testServlet"] with content.

note we are using “GetPageContext().forward(“testServlet”);”

to forward the request to the servlet.

<html>
<head>
<title>This is a test CFM page calling a Servlet page</title>
</head>
<body>
<h1>This is a test CFM page calling a Servlet page named “testServlet”</h1>
<cfscript>
GetPageContext().forward(“testServlet”);
</cfscript>
</body>
</html>

-Create a Servlet name it “testServlet.java” with content testServlet[please refer the code mentioned at the end]

once you have compiled the Servlet.

(continued through link)

Strategies and techniques for building scalable and resilient microservices to refactor a monolithic application step-by-step, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Published at DZone with permission of Ben Forta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}