March 02, 2016

How to partial reset form in primefaces


To reset input fields of a part or a component of a form programmatically , we need to use reset method similarly like we do update through managed bean.
for example I have below code snippet :

1:  <p:panel id="panel">  
2:       <p:inputText id="text1">   
3:       <p:inputText id="text2">   
4:       ...  
5:       <P:commandButton .. />  
6:  </p:panel>  

and need to reset the component ("panel") then using below code in managed bean I can reset all input fields/components under it:

 RequestContext.getCurrentInstance().reset("form:panel");  

It will reset only the component which is provided in rest method.

March 01, 2016

How to Debug JavaScript code/functions of an application using breakpoint on browser

We can debug javascript functions/scripts of an application when running it on any browser like Internet Explorer, Mozilla, Chrome etc. Browsers provides the facility to enable user to use breakpoints and start debugging the JavaScript. We can use breakpoints from where we want to inspect the code flow and results.

This debugging helps developers to understand the flow and errors if any. Following are the steps to do it.

Press F12 (Developer Mode), after running the page of your application. You will see below screen (IE11 Developer Tool):




Click on Debugger Tab, you will see HTML and JS list associated to the HTML Page. To debug any javascript function, we need to add a breakpoint as shown below (red circle in left):




When you refresh the page or trigger the action, the browser will pause the code at this breakpoint, using above icons you can execute each code and check the issues or values at run time.

January 30, 2016

How to add Tomcat 8 to Eclipse Kepler in steps with screenshots

Lot of people faces the issue while adding Tomcat 8 in Eclipse Kepler JEE IDE. Reason being it does not supports Tomcat 8 as of now. However, there are some ways we can add it. We just need to find the right server adapter of Tomcat 8 and install it into Kepler IDE. Following are the steps to do that:
  • Open Eclipse IDE.
  • Go to Help -> Install New Software..
  • Place below URL to see the items need to install
http://download.eclipse.org/webtools/repository/luna 


  • Click Next and install.
  • It will automatically install the server adapters and prompt for IDE restart.
  • Restart the IDE.
  • Go to add New server. Under Apache, now you will see Tomcat 8
Hope This helps.