Over a million developers have joined DZone.
Silver Partner

Running Servlets On ColdFusion

· Java Zone
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)

Topics:

Published at DZone with permission of Ben Forta , DZone MVB .

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}