May 6, 2013

Refreshing JSF page from Java Code

The below code can be useful to refresh JSF page from java code method. 

String currentView = context.getViewRoot().getViewId();
ViewHandler vh = context.getApplication().getViewHandler();
UIViewRoot x = vh.createView(context,currentView);
context.setViewRoot(x);

April 19, 2013

Adding Custom Skins to the application



If you want to add your own style files (CSS files) to a ADF application, please follow the below steps.

  • Create css file under the webcontent folder (css can put under subfolder also)
  • Create a trinidad-skins.xml under WEB-INF folder and create the content like below
<?xml version="1.0" encoding="windows-1252"?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
  <skin>
    <id>skin1.desktop</id>
    <family>skin1</family>
    <extends>blafplus-medium.desktop</extends>
    <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
    <style-sheet-name>skins/style.css</style-sheet-name>
    <bundle-name>resources.skinBundle</bundle-name>
  </skin>
</skins>

  • Open trinidad-config.xml file under WEB-INF folder and replace the value of the tag <skin-family> with the value of <family> tag in trinidad-skins.xml
Now you can use your CSS file in the application.

March 12, 2013

Enable logging in Weblogic to print System.out.println()



I have a web application in which I have given “System.out.println()” statements to print information, but I could not see these statements in weblogic logs. To get these print statements in weblogic logs, “stdout” should be enabled in the weblogic server log. To check this, we can follow the below procedure.

  • Go to weblogic and select the server (Ex: AdminServer) in which you want to enable this logging
  • Go to “Logging” tab of the server
  • Click on “Advanced” option
  • Enable or Check in the option “Redirect stdout logging enabledif it is not checked in
  • And also Check in the option “Redirect stderr logging enabledto print error statements in the server logs
  • After enabling these options, the screen would look as below  



  • Click on Save button and Restart the server instance