Wednesday 21 March 2012

Create a New Portlet in Liferay IDE



  1. create new Liferay Project. (File->New->Liferay Project)
  2. Type Project Name (e.g. Employee)
  3. Configure Plugin SDK and Portal Runtime(Tomcat you are using).
  4. Select Portlet in Plugin Type and click Next

  5. Check create custom portlet class and click Next.

  1. Change Portlet class name (e.g. EmployeeAction) your package name (e.g. generate.employee)
    and select super class: to GenericPortlet and click Next. 
     

  1. Type Name and edit your JSP Folder, check create resource bundle file.
     
    8. Click Next.
    9. Click Finish
     
    9. If you have set ANT_HOME then create a file in your pligin-sdk named build.username.properties  this file should contain
    app.server.dir = D:/pFiles/portal-6.0.5/tomcat-6.0.26
    contains path  to your liferay tomcat.
    then  open command Prompt. Go to your liferay-sdk->portlets-> Employee-portlet
    then Type ant deploy.

    As soon as it is deployed you would be able to see some message in your Tomcat Server 1 portlet available for use.

    Goto http://localhost:8080 in your browser or whatever port number you are using that you can verify in your running tomcat server. Login happily as admin and add the portlet. Here you go......, you can see your own custom portlet.

    Note:- If you are able to add only once(oopsy :P ...No Worries :) ). Go to liferay-portlet.xml and set

    <instanceable>true</instanceable>
    Deploy it once again and refresh your page in the browser.

No comments:

Post a Comment