Skip to main content
January 21, 2008
Question

Q: How to change items in CFC file and get them to show up.

  • January 21, 2008
  • 3 replies
  • 1077 views
Hi there, I'm relatively new to ColdFusion but have experience in ASP. I need to make some changes in a website that is hosted by an ISP. The changes involve some data queries which are in a CFC file. However, whenever I make the change and upload... nothing happens to the display on the page. The basic change involves the sort order on the page.

Is CFC some kind of compiled component that I need to reset? If so how do I do that... is there some parameter I need to set that will automatically compile after every change?
    This topic has been closed for replies.

    3 replies

    Inspiring
    January 22, 2008
    spaceboy72 wrote:
    > Unfortunately I don't have access to the admin console since it's on an ISP's
    > server.
    >

    Is there no reset function in these components? Usually when this type
    of system is done, the designer will put some kind of trigger to all the
    components to be refreshed.

    A common method is to append a 'refresh' or 'reinit' parameter to the
    URL. But one would have to access the code to determine if anything
    like this exists.

    If nothing like this exists you can take the sledge hammer approach.

    Somewhere in the code there is something that sets the newsService
    component to the application scope. Just before that line add a
    structDelete() or structClear() function to remove anything currently in
    memory.

    Of course this will remove the benefits of caching if left in place so
    would need to temporary and removed as soon as possible.

    January 22, 2008
    Unfortunately I don't have access to the admin console since it's on an ISP's server.

    I tried resetting the component, but the query changes aren't showing up... I guess the query is in an attached bean that the component uses... I thought they would be attached. How do I reload this bean? Here's some more info... the component uses the gateway to query the db.

    <bean id="newsGateway" class="com.lavanewmedia.data.NewsGateway">
    <constructor-arg name="dsn"><value>accelerator</value></constructor-arg>
    </bean>
    Inspiring
    January 21, 2008
    troubleshooting technique number 1. cfdump the variable that is returned from the cfc. If it's what you expect to see, the problem lies in the calling template. Otherwise, it lies in the cfc.
    January 21, 2008
    Sorry, I'm kind of a newbie.. I'm not sure what syntax I should use for the cfdump tag. Here's some more info about the page in question.

    It has a cfquery:
    <cfoutput query="news" group="newsItemDate">
    <h5>#DateFormat(newsItemDate,"mmmm d, yyyy")#</h5>
    </cfoutput>

    And the news is up top as:
    <cfset news = application.services.newsService.getAllNews() />

    Thanks!,
    Participating Frequently
    January 21, 2008
    spaceboy72, I think the issue lies in the line of code you posted:

    <cfset news = application.services.newsService.getAllNews() />

    The CFC is most likely called "newsService.cfc" and it contains a method named "getAllNews", correct?

    At some point when the application first starts, this CFC is placed into the application scope. The application scope is a global shared scope for all parts of the application. All users can access variables placed in the application scope as opposed to the session scope, which is specific to each user.

    Your changes are being uploaded to the server, but they have not been loaded into the application scope. In order to do this, you have two options:

    1. Restart the ColdFusion server (the service, not the physical server). This will reset all the application variables but will also turn off the site until the server restarts.

    2. Reset the value of application.services.newsService. All you'd have to do is place a temp file on the server with the code <cfset application.services.newsService = createObject("component", "path.to.NewsService").init() />

    Search for the line "<cfset application.services.newsService" to get the exact syntax.

    Once the new code has been loaded into the application scope, you should see the change in sort order.

    HTH