I have created a jsf page with colorpickers to allow an administrator to modify the main theme of the site, which consists of 4 colors. I have prefixed my main colors in the css file with numbers like this:
.element{
background: /*1*/#333333;
}
When obtaining the colors, I search through all css files and extract the color corresponding to each number (ranging from 1 to 4). The retrieval process works fine, but when attempting to set the colors and refresh the page, the css disappears. However, upon cleaning the project, the .css file is restored with the original colors.
The code that I am using is a bit complex, but here it is:
@ManagedBean
public class SiteColorsSettings {
private String color1, color2, color3, color4;
private final String CSS_FOLDER_PATH = "/resources/css";
ServletContext ctx;
String realPath;
public SiteColorsSettings() {
ctx = (ServletContext) FacesContext.getCurrentInstance()
.getExternalContext().getContext();
realPath = ctx.getRealPath("/");
getColors();
}
// Methods for getting and setting colors
The issue at hand is puzzling. Am I modifying the deployed files while leaving the project untouched? If so, why is there no css visible on my page after refreshing it? Despite checking the string "fileContent" and confirming that the css is present...