CSS + JS load problem

Viewpoint
Enthusiast

CSS + JS load problem

Hi everyone,

I am struggling with the following problem (detailed steps below) when trying to develop portlet using PDK:

1. Create a new portlet using the portletGenerator.jar
2. In this generated portlet, the include.jsp file should already place the one default css file with the portlet name under an enclosed vp:managedResource tag
3. Edit this css file, to add in some simple style like: p .dummy { font-size: 30px; }
4. Edit the summary.jsp file to use the above style.
5. Deploy the portlet using: ant deploy, from the generated portlet directory
6. The resulting portlet is working properly with the style.
7. However, when I return to edit the css file, like changing the above font-size to 50px. After re-deploy the portlet, the result remains 30px. Moreover, it seems that I am not able to add in any further styles into that css file, all of them will not be effective when used and the portlet is re-deployed.
8. The same happens to javascript file, it only works for the first deployment, but will not show any changes that I add in for subsequent deployments.

Can somebody help explain the above behavior and how to navigate through it? Many thanks !!!

Warmest regards,
4 REPLIES
dfu
Teradata Employee

Re: CSS + JS load problem

Have you cleared your browser cache after your css/js changes? Usually the browser caches these for a period of time by default.
Enthusiast

Re: CSS + JS load problem

Hi dfu,

I have tried clearing the browser cache as one of the first things I thought of, but the problem remains. I find a temporary fix to this problem by manually include those css and js files outside of the vp:managedResource tag. It would be helpful if I understand what the vp tag is doing.

Warmest regards,
dfu
Teradata Employee

Re: CSS + JS load problem

vp:managedResources tag basically calls TDResourceManager.registerCSS() and . registerJavascript() to ensure that each portlet's javascript and css includes are moved/included in the "head" section of the html page so they load correctly.
Enthusiast

Re: CSS + JS load problem

Hi dfu,

Thanks for the information. But at the moment, I would still stick to the temporary fix that I mentioned earlier.