SlideShare une entreprise Scribd logo
1  sur  12
GWT with Liferay Portal 
Creating JSR-168/JSR-286 Portlets with Google Web 
Toolkit (GWT) using Liferay Portal 
If you are starting from scratch, follow these steps. I’m using the Eclipse Indigo IDE, although 
you could try something else, such as NetBeans. I’m also working on Windows, but I’m sure you 
could do the same on Mac or Linux. (Note that as of this writing, on the Mac you need a 
Leopard or Snow Leopard to run GWT 2.0). Note that if you’re following all these install steps, 
the downloads could take some time as it totals about 300MB. 
Contents: 
1. Install Eclipse 
2. Install GWT 
3. Install a Java JDK 
4. Install Ant 1.8 or later 
5. Set Environment Variables 
6. Install the Liferay Server (a Portal Server) 
7. Create a Portlet 
8. Install PortalPack for Eclipse 
9. Deploy the Portlet 
10. Add GWT to the Portlet 
11. Try it Out 
1. Install Eclipse - Download Eclipse Java EE IDE (current version is 3.7.2). 
http://www.eclipse.org/downloads/ 
Extract the zip file into your Development directory. I created a folder for all my development 
work “C:Practice”. e.g. don’t use the “Program Files” directory. 
- Run Eclipse. I created a workspace folder in my C:Practice directory called practice_workspace 
to keep things straightforward and organized. Or you can accept the default workspace. 
Developed by EWT-Practice team
GWT with Liferay Portal 
2. Install GWT 
- In Eclipse, go to the “Workbench” (the main development screen). 
- From the Help menu, choose “Install New Software…” 
- Enter “http://dl.google.com/eclipse/plugin/3.7″, click Add. Give it a name like GWT or whatever makes 
sense to you. 
- It will give you the option to add the Plugin, and 2 items under SDKs. Check at least the Google Plugin 
and the Google Web Toolkit SDK. The Google App Engine is optional — you might want it if you need to 
deploy a highly scalable web app. I don’t use it here. 
Developed by EWT-Practice team
GWT with Liferay Portal 
- click Next, Next, accept the license agreement, and Finish. It should install the pieces you selected, and 
the download could take some time. 
3.Install a Java JDK 
- The Java JDK download is here: http://java.sun.com/javase/downloads/index.jsp 
I chose just the JDK+Java EE bundle, but you should be fine with just the JDK. 
- Run the installer. I installed to C:Practice. Make sure it is installing everything in the Development 
directory. Click on all 4 items and change them to your Practice directory if they do not point there. 
4. Install Ant 1.7 or later 
- Donwload: http://ant.apache.org/bindownload.cgi 
- Unzip the download to an appropriate directory. I used C:PracticeAnt. 
5. Set Environment Variables 
- set the ANT_HOME environment variable to point to the Ant installation directory. 
- set the JAVA_HOME environment variable to point to your Java JDK installation directory. 
6. Install the Liferay Server (a Portal Server) 
Why Liferay 
Liferay is the only open source portal rated by Gartner as a leader in its Magic Quadrant for 
horizontal portal segment at par with IBM, Microsoft, Oracle & SAP. 
Developed by EWT-Practice team
GWT with Liferay Portal 
Liferay Portal equips you with the features, scalability, and modularity of the world’s leading 
open source enterprise portal platform to realize your goals. Various companies have leveraged 
Liferay Portal for their solution-building needs to propel their businesses and organizations to 
the next level. 
Liferay IDE provides the best-of-breed eclipse tooling for Liferay Portal development platform for 
versions 6.0 and 6.1. 
- In Eclipse, go to the “Workbench” (the main development screen). 
- From the Help menu, choose “Install New Software…” 
- Enter “http://marketplace.eclipse.org/content/liferay-ide″, click Add. Give it a name like Liferay or 
whatever makes sense to you. 
For more information on the latest release of the Liferay IDE see below: 
http://www.liferay.com/web/gregory.amerson/blog/-/blogs/liferay-ide-1-5-release 
Also the main documentation and community information about the Liferay IDE is located on the 
following page: 
http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE 
Once you completed the installation, - In Eclipse, go to the “Workbench” (the main development 
screen). 
Developed by EWT-Practice team
GWT with Liferay Portal 
- From the Help menu, choose “About Eclipse”  “Installation Details” 
7. Create a Portlet 
The way that the PortalPack works is that first you create a Liferay Project that supports portlets, and 
then you add a portlet to it, rather than just creating a Portlet project from the beginning. 
- Choose File–>New and choose Liferay Project. Specify the Target runtime as Liferay v6.0 CE Server. 
Under Configuration, choose Portlet 2.0 Support (you may have to scroll down to see that option). Or 
choose Portlet 1.0 support if you are making a JSR-168, and specifically not a JSR-286 portlet. 
I named my project EWTPortalProject 
- Click Finish, and the project will be created. 
- Choose File –> New, and Other… (at the bottom of the menu). Open up the Portlet Folder, and choose 
EWTGWTPortlet. Click Next. 
- Enter a package name for the portlet, and a Class Name. Leave all the boxes checked for Create JSP, 
Edit, and Help. Click Finish. 
8. Install PortalPack for Eclipse 
Download of liferay-plugins-sdk-6.0.2.zip (9,181,832 bytes/MD5:d89f17114811bceae59db7bb31852c42) 
http://en.sourceforge.jp/projects/sfnet_lportal/downloads/Liferay%20Portal/6.0.2/liferay-plugins-sdk- 
6.0.2.zip/ 
Extract the zip file into your Development directory. I created a folder for all my development work 
“C:Practice”. 
Developed by EWT-Practice team
GWT with Liferay Portal 
Right click on your project, I am using EWTPortalProject  Properties  Java Build Path  Add 
External Jars 
9. Deploy the Portlet 
- to run the portlet, make sure that you have shut down the Liferay server, if you’re following these 
instructions step-by-step. Then right-click on the project title, and choose Run As –> Run On Server. 
This should cause Liferay server to start up. After it’s started, Eclipse might try to open the project in a 
browser, but this won’t work since it uses the project name as the Context in the URL. Instead, once 
Liferay has started, go to a browser window, and open Liferay Portal at “http://localhost:8080″. Now 
wait. 
In my case 
http://localhost:8089/web/ewtpractice/home 
Developed by EWT-Practice team
GWT with Liferay Portal 
- It might take a minute or two, and then you will see the Welcome screen. Click the link “Express login 
as test” to login to the portal. 
- Add a new page to the portal by clicking on Add Page in the upper right. Then click on the new page’s 
tab to get to the page. 
- Drop down the menu to the right of the words “Welcome Admin User!” and choose Add Application. A 
dialog listing portlet categories will appear. 
- The user-interface of this screen is a bit misleading. Just type the first few letters of the name of your 
portlet. For my example, I type “EWT”. It then shows “EWTPortlet” and I can click Add to add it to the 
page. 
10. Add GWT to the Portlet 
Now we will add GWT to the portlet. I’m sure there are other (and probably better) ways to do this, but 
I’ll describe what worked for me. 
- create a GWT project. In Eclipse, choose File–>New, and Web Application Project (with the little blue 
GWT icon). You must give it a name, and a package. I named mine GWTApp and gave it the same 
package name as my portlet above (just “test” for simplicity). I also unchecked “Use Google App Engine” 
since this is just a simple test. Click Finish and the project will be created. 
Developed by EWT-Practice team
GWT with Liferay Portal 
You might want to test your GWT app. There are 2 modes in which you can run it — Development and 
Production. To test it in Development mode, right-click and choose Run As… or Debug As… and then 
Web Application. GWT will start a Jetty server and give you a URL you can paste into a web browser. If 
you are doing this for the first time, GWT will prompt you to download the Development plugin for your 
browser. I discovered that the Dev plugin is not compatible with Firefox 3.6 (as of this writing), so make 
sure you have an older Firefox, if that’s what you’re using. And it also only works with Chrome 4.0 which 
is not generally available. I didn’t try Exploder or Safari. 
- compile the GWT app: Once you are done testing, right-click on the GWT app, and choose Google– 
>GWT Compile. The settings you choose don’t matter too much. I like the Output Style to be “Pretty” 
so I can read the resulting Javascript. 
Developed by EWT-Practice team
GWT with Liferay Portal 
Now we will copy the necessary components over to the Portlet. This is probably more easily done in 
Navigator View. To see Navigator View, from the Window menu, choose Show View, and then 
Navigator. 
- copy over all the source files, which you should find in <your-package-name>.client and <your-package-name>. 
server. Also copy the <GWT-App-Name>.gwt.xml file that you find in the package. You can right 
click on the folders, and copy them. Then paste into the Portlet project src/<package-name> folder. 
This is where it comes in handy to have the same package names in both projects. 
- compiling the GWT app should have created a subfolder under the “war” folder with the name of your 
project. For me, it was called “gwtapp”. Copy this entire folder into the “WebContent” folder of your 
Portlet project. 
You may get a compile error once you have copied over the src. That’s because the Portlet project 
doesn’t have all the right JAR/library files yet. 
- copy war/WEB-INF/lib/gwt-servlet.jar to WebContent/WEB-INF/lib in the Portlet project. 
- There are 2 library jars that are referenced in the GWT app that we need to add to the Portlet project. 
If you switch back to the Project Explorer View in Eclipse, you can see them under GWT SDK. They are 
gwt-user.jar and gwt-dev.jar. The view should show where they are located. You need to know this as 
you will have to find them via a file system dialog. Also, you can right-click on one, and choose “Copy 
Qualified Name” if you want to paste the location somewhere else. 
Developed by EWT-Practice team
GWT with Liferay Portal 
- Now, right-click on the Portlet project, and choose Properties at the bottom of the menu. Then click 
“Java Build Path”. Click the Libraries tab, and the button “Add External Jars…”. Now you have to find 
the gwt-dev.jar and gwt-user.jar files in the file system. Add both jars to the build path. This should 
make any compile errors go away (when Eclipse recompiles). 
- If you want to use the GWT style sheet, copy the war/<project-name>.css file to the Portlet project’s 
WebContent directory. 
- Next we need to add the Servlet references from the GWT app to the Portlet project. Open the 
web.xml files from both projects. Copy the Servlet definition and mapping from the GWT App’s web.xml 
into the Portlet project’s XML. That means everything under <!– Servlets –>. 
- Finally, we need to update the View JSP so that it will use the GWT code. Open the war/<project-name>. 
html file in your GWT app. Also open the WebContent/WEB-INF/jsp/<project-name>_view.jsp 
file in your Portlet project. 
- in the GWT html file, copy the line that refers to the CSS and paste it into your view.jsp. Put it above 
the beginning of the regular HTML, but below the @page directives. 
- in the GWT html file, copy the line that includes a javascript file where the src ends in “nocache.js”. 
- copy the HTML from the beginning of the table tag to the closing table tag, and put it at the bottom of 
your view.jsp file. 
- finally, we need to update the file references in the view.jsp to include the context root of the Portlet 
project. This will normally be the name of your project. So, for me, I changed 
src=”gwtapp/gwtapp.nocache.js” 
to 
src=”/EWTPortalProject/gwtapp/gwtapp.nocache.js” 
Likewise for the CSS reference, I changed “GWTApp.css” to “/EWTPortalProject/GWTApp.css” 
- Save the view.jsp file. This should (eventually) automatically publish to your Liferay server, if you’ve 
left the Liferay server running. Otherwise, you can choose Run As… –> Run On Server 
11. Try It Out 
Go to your browser, and enter http://localhost:8080. Login as Admin, and go to your Test Page with the 
test portlet. You should see the GWT-generated input box, and Send button. When you click Send, it 
should get a response and show a dialog that shows it’s running on Liferay! 
Developed by EWT-Practice team
GWT with Liferay Portal 
That’s it. Now you can play around with creating more complex behaviour via GWT, and adding it into a 
Portlet. It would be nice if it all worked in a single project in Eclipse 
EWTPortal BlankPage 
Now I added the EWTGWTPortlet into the page 
Developed by EWT-Practice team
GWT with Liferay Portal 
You should see the GWT-generated input box, and Send button. When you click Send, it should get a 
response and show a dialog that shows it’s running on Liferay! 
I hope this was helpful to some associates, and let me know if you encounter any errors in the above. 
Cheers! 
Developed by EWT-Practice team

Contenu connexe

Tendances

Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseRalf Sternberg
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
Building Eclipse Plugins with Tycho
Building Eclipse Plugins with TychoBuilding Eclipse Plugins with Tycho
Building Eclipse Plugins with Tychojsievers
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Startervcaselli
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02rhemsolutions
 
Features java9
Features java9Features java9
Features java9srmohan06
 
Using The EGit Eclipse Plugin With Git Hub
Using The EGit Eclipse Plugin With Git HubUsing The EGit Eclipse Plugin With Git Hub
Using The EGit Eclipse Plugin With Git Hubguest4bce3214
 
Maven plugin guide using Modello Framework
Maven plugin guide using Modello FrameworkMaven plugin guide using Modello Framework
Maven plugin guide using Modello Frameworkfulvio russo
 
How to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHow to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHaitham Refaat
 
Integrating external products into eclipse
Integrating external products into eclipseIntegrating external products into eclipse
Integrating external products into eclipseGirish Balre
 
Jupyter notebook 20200728
Jupyter notebook 20200728Jupyter notebook 20200728
Jupyter notebook 20200728Haim Michael
 
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...MarcinStachniuk
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch Haitham Refaat
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKitLouis D'hauwe
 
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Luciano Mammino
 
2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the TrenchesNicolas Fränkel
 

Tendances (20)

Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Building Eclipse Plugins with Tycho
Building Eclipse Plugins with TychoBuilding Eclipse Plugins with Tycho
Building Eclipse Plugins with Tycho
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Starter
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
Features java9
Features java9Features java9
Features java9
 
Using The EGit Eclipse Plugin With Git Hub
Using The EGit Eclipse Plugin With Git HubUsing The EGit Eclipse Plugin With Git Hub
Using The EGit Eclipse Plugin With Git Hub
 
Maven plugin guide using Modello Framework
Maven plugin guide using Modello FrameworkMaven plugin guide using Modello Framework
Maven plugin guide using Modello Framework
 
How to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHow to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipse
 
Integrating external products into eclipse
Integrating external products into eclipseIntegrating external products into eclipse
Integrating external products into eclipse
 
Jupyter notebook 20200728
Jupyter notebook 20200728Jupyter notebook 20200728
Jupyter notebook 20200728
 
OpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdfOpenTok_API_Tutorials.pdf
OpenTok_API_Tutorials.pdf
 
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w...
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch
 
0900 learning-react
0900 learning-react0900 learning-react
0900 learning-react
 
Android programming-basics
Android programming-basicsAndroid programming-basics
Android programming-basics
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKit
 
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
 
Rock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer ElementsRock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer Elements
 
2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches
 

Similaire à Gwt portlet

Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingSarah Elson
 
Joget v5 Getting Started Guide
Joget v5 Getting Started GuideJoget v5 Getting Started Guide
Joget v5 Getting Started GuideJoget Workflow
 
Installating and Configuring Java, MySQL and BIRT.
Installating and Configuring Java, MySQL and BIRT.Installating and Configuring Java, MySQL and BIRT.
Installating and Configuring Java, MySQL and BIRT.NR Computer Learning Center
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServerPaul Graham
 
Orangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
Joget Workflow v4 Getting Started
Joget Workflow v4 Getting StartedJoget Workflow v4 Getting Started
Joget Workflow v4 Getting StartedJoget Workflow
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN ControllerSumit Arora
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programmingKuntal Bhowmick
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textToma Velev
 
Getting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platformGetting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platformJean-Michel Bouffard
 

Similaire à Gwt portlet (20)

Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Joget v5 Getting Started Guide
Joget v5 Getting Started GuideJoget v5 Getting Started Guide
Joget v5 Getting Started Guide
 
Gwt Presentation 1
Gwt Presentation 1Gwt Presentation 1
Gwt Presentation 1
 
Installating and Configuring Java, MySQL and BIRT.
Installating and Configuring Java, MySQL and BIRT.Installating and Configuring Java, MySQL and BIRT.
Installating and Configuring Java, MySQL and BIRT.
 
Installing the java sdk
Installing the java sdkInstalling the java sdk
Installing the java sdk
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServer
 
Slim3 quick start
Slim3 quick startSlim3 quick start
Slim3 quick start
 
Orangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User Manual
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Joget Workflow v4 Getting Started
Joget Workflow v4 Getting StartedJoget Workflow v4 Getting Started
Joget Workflow v4 Getting Started
 
Jakarta struts
Jakarta strutsJakarta struts
Jakarta struts
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
 
DotNetNuke
DotNetNukeDotNetNuke
DotNetNuke
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Mc sl54 051_ (1)
Mc sl54 051_ (1)Mc sl54 051_ (1)
Mc sl54 051_ (1)
 
Getting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platformGetting started with open mobile development on the Openmoko platform
Getting started with open mobile development on the Openmoko platform
 
InitiateAEv2.pdf
InitiateAEv2.pdfInitiateAEv2.pdf
InitiateAEv2.pdf
 

Plus de prabakaranbrick

Install and configure mongo db nosql db on windows
Install and configure mongo db nosql db on windowsInstall and configure mongo db nosql db on windows
Install and configure mongo db nosql db on windowsprabakaranbrick
 
Web services for remote portlets v01
Web services for remote portlets v01Web services for remote portlets v01
Web services for remote portlets v01prabakaranbrick
 
Jackrabbit setup configuration
Jackrabbit setup configurationJackrabbit setup configuration
Jackrabbit setup configurationprabakaranbrick
 
Integrating open am with liferay portal
Integrating open am with liferay portalIntegrating open am with liferay portal
Integrating open am with liferay portalprabakaranbrick
 
Hadoop cluster configuration
Hadoop cluster configurationHadoop cluster configuration
Hadoop cluster configurationprabakaranbrick
 
Installation and configure the oracle webcenter
Installation and configure the oracle webcenterInstallation and configure the oracle webcenter
Installation and configure the oracle webcenterprabakaranbrick
 

Plus de prabakaranbrick (9)

Install and configure mongo db nosql db on windows
Install and configure mongo db nosql db on windowsInstall and configure mongo db nosql db on windows
Install and configure mongo db nosql db on windows
 
Sonar
SonarSonar
Sonar
 
Web services for remote portlets v01
Web services for remote portlets v01Web services for remote portlets v01
Web services for remote portlets v01
 
Jmeter
JmeterJmeter
Jmeter
 
Nuxeo dm installation
Nuxeo dm installationNuxeo dm installation
Nuxeo dm installation
 
Jackrabbit setup configuration
Jackrabbit setup configurationJackrabbit setup configuration
Jackrabbit setup configuration
 
Integrating open am with liferay portal
Integrating open am with liferay portalIntegrating open am with liferay portal
Integrating open am with liferay portal
 
Hadoop cluster configuration
Hadoop cluster configurationHadoop cluster configuration
Hadoop cluster configuration
 
Installation and configure the oracle webcenter
Installation and configure the oracle webcenterInstallation and configure the oracle webcenter
Installation and configure the oracle webcenter
 

Dernier

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 

Dernier (20)

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Gwt portlet

  • 1. GWT with Liferay Portal Creating JSR-168/JSR-286 Portlets with Google Web Toolkit (GWT) using Liferay Portal If you are starting from scratch, follow these steps. I’m using the Eclipse Indigo IDE, although you could try something else, such as NetBeans. I’m also working on Windows, but I’m sure you could do the same on Mac or Linux. (Note that as of this writing, on the Mac you need a Leopard or Snow Leopard to run GWT 2.0). Note that if you’re following all these install steps, the downloads could take some time as it totals about 300MB. Contents: 1. Install Eclipse 2. Install GWT 3. Install a Java JDK 4. Install Ant 1.8 or later 5. Set Environment Variables 6. Install the Liferay Server (a Portal Server) 7. Create a Portlet 8. Install PortalPack for Eclipse 9. Deploy the Portlet 10. Add GWT to the Portlet 11. Try it Out 1. Install Eclipse - Download Eclipse Java EE IDE (current version is 3.7.2). http://www.eclipse.org/downloads/ Extract the zip file into your Development directory. I created a folder for all my development work “C:Practice”. e.g. don’t use the “Program Files” directory. - Run Eclipse. I created a workspace folder in my C:Practice directory called practice_workspace to keep things straightforward and organized. Or you can accept the default workspace. Developed by EWT-Practice team
  • 2. GWT with Liferay Portal 2. Install GWT - In Eclipse, go to the “Workbench” (the main development screen). - From the Help menu, choose “Install New Software…” - Enter “http://dl.google.com/eclipse/plugin/3.7″, click Add. Give it a name like GWT or whatever makes sense to you. - It will give you the option to add the Plugin, and 2 items under SDKs. Check at least the Google Plugin and the Google Web Toolkit SDK. The Google App Engine is optional — you might want it if you need to deploy a highly scalable web app. I don’t use it here. Developed by EWT-Practice team
  • 3. GWT with Liferay Portal - click Next, Next, accept the license agreement, and Finish. It should install the pieces you selected, and the download could take some time. 3.Install a Java JDK - The Java JDK download is here: http://java.sun.com/javase/downloads/index.jsp I chose just the JDK+Java EE bundle, but you should be fine with just the JDK. - Run the installer. I installed to C:Practice. Make sure it is installing everything in the Development directory. Click on all 4 items and change them to your Practice directory if they do not point there. 4. Install Ant 1.7 or later - Donwload: http://ant.apache.org/bindownload.cgi - Unzip the download to an appropriate directory. I used C:PracticeAnt. 5. Set Environment Variables - set the ANT_HOME environment variable to point to the Ant installation directory. - set the JAVA_HOME environment variable to point to your Java JDK installation directory. 6. Install the Liferay Server (a Portal Server) Why Liferay Liferay is the only open source portal rated by Gartner as a leader in its Magic Quadrant for horizontal portal segment at par with IBM, Microsoft, Oracle & SAP. Developed by EWT-Practice team
  • 4. GWT with Liferay Portal Liferay Portal equips you with the features, scalability, and modularity of the world’s leading open source enterprise portal platform to realize your goals. Various companies have leveraged Liferay Portal for their solution-building needs to propel their businesses and organizations to the next level. Liferay IDE provides the best-of-breed eclipse tooling for Liferay Portal development platform for versions 6.0 and 6.1. - In Eclipse, go to the “Workbench” (the main development screen). - From the Help menu, choose “Install New Software…” - Enter “http://marketplace.eclipse.org/content/liferay-ide″, click Add. Give it a name like Liferay or whatever makes sense to you. For more information on the latest release of the Liferay IDE see below: http://www.liferay.com/web/gregory.amerson/blog/-/blogs/liferay-ide-1-5-release Also the main documentation and community information about the Liferay IDE is located on the following page: http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE Once you completed the installation, - In Eclipse, go to the “Workbench” (the main development screen). Developed by EWT-Practice team
  • 5. GWT with Liferay Portal - From the Help menu, choose “About Eclipse”  “Installation Details” 7. Create a Portlet The way that the PortalPack works is that first you create a Liferay Project that supports portlets, and then you add a portlet to it, rather than just creating a Portlet project from the beginning. - Choose File–>New and choose Liferay Project. Specify the Target runtime as Liferay v6.0 CE Server. Under Configuration, choose Portlet 2.0 Support (you may have to scroll down to see that option). Or choose Portlet 1.0 support if you are making a JSR-168, and specifically not a JSR-286 portlet. I named my project EWTPortalProject - Click Finish, and the project will be created. - Choose File –> New, and Other… (at the bottom of the menu). Open up the Portlet Folder, and choose EWTGWTPortlet. Click Next. - Enter a package name for the portlet, and a Class Name. Leave all the boxes checked for Create JSP, Edit, and Help. Click Finish. 8. Install PortalPack for Eclipse Download of liferay-plugins-sdk-6.0.2.zip (9,181,832 bytes/MD5:d89f17114811bceae59db7bb31852c42) http://en.sourceforge.jp/projects/sfnet_lportal/downloads/Liferay%20Portal/6.0.2/liferay-plugins-sdk- 6.0.2.zip/ Extract the zip file into your Development directory. I created a folder for all my development work “C:Practice”. Developed by EWT-Practice team
  • 6. GWT with Liferay Portal Right click on your project, I am using EWTPortalProject  Properties  Java Build Path  Add External Jars 9. Deploy the Portlet - to run the portlet, make sure that you have shut down the Liferay server, if you’re following these instructions step-by-step. Then right-click on the project title, and choose Run As –> Run On Server. This should cause Liferay server to start up. After it’s started, Eclipse might try to open the project in a browser, but this won’t work since it uses the project name as the Context in the URL. Instead, once Liferay has started, go to a browser window, and open Liferay Portal at “http://localhost:8080″. Now wait. In my case http://localhost:8089/web/ewtpractice/home Developed by EWT-Practice team
  • 7. GWT with Liferay Portal - It might take a minute or two, and then you will see the Welcome screen. Click the link “Express login as test” to login to the portal. - Add a new page to the portal by clicking on Add Page in the upper right. Then click on the new page’s tab to get to the page. - Drop down the menu to the right of the words “Welcome Admin User!” and choose Add Application. A dialog listing portlet categories will appear. - The user-interface of this screen is a bit misleading. Just type the first few letters of the name of your portlet. For my example, I type “EWT”. It then shows “EWTPortlet” and I can click Add to add it to the page. 10. Add GWT to the Portlet Now we will add GWT to the portlet. I’m sure there are other (and probably better) ways to do this, but I’ll describe what worked for me. - create a GWT project. In Eclipse, choose File–>New, and Web Application Project (with the little blue GWT icon). You must give it a name, and a package. I named mine GWTApp and gave it the same package name as my portlet above (just “test” for simplicity). I also unchecked “Use Google App Engine” since this is just a simple test. Click Finish and the project will be created. Developed by EWT-Practice team
  • 8. GWT with Liferay Portal You might want to test your GWT app. There are 2 modes in which you can run it — Development and Production. To test it in Development mode, right-click and choose Run As… or Debug As… and then Web Application. GWT will start a Jetty server and give you a URL you can paste into a web browser. If you are doing this for the first time, GWT will prompt you to download the Development plugin for your browser. I discovered that the Dev plugin is not compatible with Firefox 3.6 (as of this writing), so make sure you have an older Firefox, if that’s what you’re using. And it also only works with Chrome 4.0 which is not generally available. I didn’t try Exploder or Safari. - compile the GWT app: Once you are done testing, right-click on the GWT app, and choose Google– >GWT Compile. The settings you choose don’t matter too much. I like the Output Style to be “Pretty” so I can read the resulting Javascript. Developed by EWT-Practice team
  • 9. GWT with Liferay Portal Now we will copy the necessary components over to the Portlet. This is probably more easily done in Navigator View. To see Navigator View, from the Window menu, choose Show View, and then Navigator. - copy over all the source files, which you should find in <your-package-name>.client and <your-package-name>. server. Also copy the <GWT-App-Name>.gwt.xml file that you find in the package. You can right click on the folders, and copy them. Then paste into the Portlet project src/<package-name> folder. This is where it comes in handy to have the same package names in both projects. - compiling the GWT app should have created a subfolder under the “war” folder with the name of your project. For me, it was called “gwtapp”. Copy this entire folder into the “WebContent” folder of your Portlet project. You may get a compile error once you have copied over the src. That’s because the Portlet project doesn’t have all the right JAR/library files yet. - copy war/WEB-INF/lib/gwt-servlet.jar to WebContent/WEB-INF/lib in the Portlet project. - There are 2 library jars that are referenced in the GWT app that we need to add to the Portlet project. If you switch back to the Project Explorer View in Eclipse, you can see them under GWT SDK. They are gwt-user.jar and gwt-dev.jar. The view should show where they are located. You need to know this as you will have to find them via a file system dialog. Also, you can right-click on one, and choose “Copy Qualified Name” if you want to paste the location somewhere else. Developed by EWT-Practice team
  • 10. GWT with Liferay Portal - Now, right-click on the Portlet project, and choose Properties at the bottom of the menu. Then click “Java Build Path”. Click the Libraries tab, and the button “Add External Jars…”. Now you have to find the gwt-dev.jar and gwt-user.jar files in the file system. Add both jars to the build path. This should make any compile errors go away (when Eclipse recompiles). - If you want to use the GWT style sheet, copy the war/<project-name>.css file to the Portlet project’s WebContent directory. - Next we need to add the Servlet references from the GWT app to the Portlet project. Open the web.xml files from both projects. Copy the Servlet definition and mapping from the GWT App’s web.xml into the Portlet project’s XML. That means everything under <!– Servlets –>. - Finally, we need to update the View JSP so that it will use the GWT code. Open the war/<project-name>. html file in your GWT app. Also open the WebContent/WEB-INF/jsp/<project-name>_view.jsp file in your Portlet project. - in the GWT html file, copy the line that refers to the CSS and paste it into your view.jsp. Put it above the beginning of the regular HTML, but below the @page directives. - in the GWT html file, copy the line that includes a javascript file where the src ends in “nocache.js”. - copy the HTML from the beginning of the table tag to the closing table tag, and put it at the bottom of your view.jsp file. - finally, we need to update the file references in the view.jsp to include the context root of the Portlet project. This will normally be the name of your project. So, for me, I changed src=”gwtapp/gwtapp.nocache.js” to src=”/EWTPortalProject/gwtapp/gwtapp.nocache.js” Likewise for the CSS reference, I changed “GWTApp.css” to “/EWTPortalProject/GWTApp.css” - Save the view.jsp file. This should (eventually) automatically publish to your Liferay server, if you’ve left the Liferay server running. Otherwise, you can choose Run As… –> Run On Server 11. Try It Out Go to your browser, and enter http://localhost:8080. Login as Admin, and go to your Test Page with the test portlet. You should see the GWT-generated input box, and Send button. When you click Send, it should get a response and show a dialog that shows it’s running on Liferay! Developed by EWT-Practice team
  • 11. GWT with Liferay Portal That’s it. Now you can play around with creating more complex behaviour via GWT, and adding it into a Portlet. It would be nice if it all worked in a single project in Eclipse EWTPortal BlankPage Now I added the EWTGWTPortlet into the page Developed by EWT-Practice team
  • 12. GWT with Liferay Portal You should see the GWT-generated input box, and Send button. When you click Send, it should get a response and show a dialog that shows it’s running on Liferay! I hope this was helpful to some associates, and let me know if you encounter any errors in the above. Cheers! Developed by EWT-Practice team