Skip to main content
Participating Frequently
March 11, 2010
Question

Fetch variable in cfm

  • March 11, 2010
  • 1 reply
  • 512 views

I have a String variable in JSP that I would like to forward to a ColdFusion 8 web page.

I tried forwarding the variable to ColdFusion and it doesnt show anything in the page.

Please advise how I can fetch a JSP variable in ColdFusion?

    This topic has been closed for replies.

    1 reply

    Inspiring
    March 11, 2010

    Take a look at the ColdFusion documentation.

    "Interoperating with JSP pages and servlets"

    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-786c.html

    OaklanderAuthor
    Participating Frequently
    March 19, 2010

    Thanks, I am using ColdFusion 8 and I tried both attempts below where the hello.jsp is a simple hello world message:

    <cfscript>
    GetPageContext().include("http://myserver:8080/myapp/hello.jsp");
    </cfscript>

    and

    <cfoutput>

    #GetPageContext().include("http://myserver:8080/myapp/hello.jsp")#

    </cfoutput>

    Both came back with error on the GetPageContext() method with no further explanation of the ColdFusion error.

    Please advise.

    BKBK
    Community Expert
    Community Expert
    March 20, 2010

    Use a relative URL instead. Here is an example I gave in a previous thread on JSP:

    TimeNow.jsp
    ==========
    <%
    java.util.Date thisDate = new java.util.Date();
    %>
    Hello World, the time is now <%= thisDate %>

    getTheTime.cfm
    ============
    <cfset theTime = getPageContext().include("TimeNow.jsp")>