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.
 

January 10, 2016

How to set multiple Default Command using Primefaces 5

Primefaces 5, gives a feature to allow multiple defaultcommand (ENTER) within a form.
Default Command can be use to define which commandbutton should be triggered when the enter key is pressed.

Following is the code for defining defaultCommand in primefaces.

 <p:defaultCommand target="buttonId" />  
target is the identifier of commandbutton that needs to be triggered.

Now, to allow mutiple command buttons triggering within the same form we need to use scope attribute in the same tag as below:

 <p:defaultCommand target="buttonId" scope="panelgrid_id" />  
 Example,  
 <h:panelGrid columns="2" cellpadding="5" id="panelgrid1">   
      <h:outputLabel for="btnSelect" value="Button 1:" />   
 ................  
 ................  
 <p:commandButton value="Button1" id="btn1" actionListener="#{defaultCommandView.btn1Submit}" />   
 <p:defaultCommand target="btn1" scope="panelgrid1" />  
 </h:panelGrid>   
 <p:separator />   
 <h:panelGrid columns="3" cellpadding="5" id="panelgrid2">   
 <h:outputLabel for="btnSelect" value="Button 1:" />   
 ................  
 ................  
 <p:commandButton value="Button2" id="btn2" actionListener="#{defaultCommandView.btn2Submit}" />   
 <p:defaultCommand target="btn2" scope="panelgrid2" />  
 </h:panelGrid>  
There are 2 default command tags been used in above code so, if user has any input text in focus under panel grid one then it on press on ENTER key then it will trigger command button one. Similarly for command button second.
 

April 03, 2014

How to deploy EJB 2.x in Tomee Server

TOMEE Server is an enterprise application server where you can deploy and run enterprise components such as EJBs.
Tomee uses OPENEJB framework to run EJBs in tomcat.
However, there are still some configurations and steps thats needs to be follow while deploying EJBs 2.x in TOMEE and make it run.
  1. Same as in another enterprise servers, we need to package EJBs in EAR file.
  2. EAR files cannot be deploy in webapps folder of TOMEE.
  3. To deploy EAR files, TOMEE have one more folder named as apps, where you can place enterprise related component jars/ears.
  4. By-default, this features is disabled and can be enable by editing tomee.xml which resides under conf folder.
  5. Just uncomment below line in tomee.xml and save the file
    <Deployments dir=\"apps\" />
  6. Restart the server, it will create a folder named apps besides webapps folder (If not then create the folder manually with same name and restart the server).
  7. Once the folder gets created, copy your EAR file there and again restart the server.
  8. Once the server gets restarted you will see extracted EAR folder and deployed EJBs in Tomee server console.
You can see EJBs details like ejbname, JNDI name , EJBID and other details in tomee server console.