Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Guest
Jan 21, 2008 Jan 21, 2008
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?
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 21, 2008 Jan 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 21, 2008 Jan 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!,
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 21, 2008 Jan 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2008 Jan 22, 2008
quote:

Originally posted by: spaceboy72
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!,

It's all in the cfml reference manual. If you don't have one, the internet does.

Google is your freind. If you want to see what a tag does, search on "<name of tag> x" where x is the version number of Cold Fusion that you are using. If you want to see what a function does, search on "coldfusion name of function x". In both case, the cfml page will almost always be your first offering.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 22, 2008 Jan 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>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2008 Jan 22, 2008
LATEST
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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources