What I really like in JDeveloper is the easiness to create JSR 286 Portlets. Since I want to write several articles about creating and using JSR 286 Portlets in Oracle WebCenter Portal let me give you the here the first step about creating such a portlets.
Step 1: Open JDeveloper and click on New Application. To be able to start developing a portlet you do need first to create Portlet Producer Application. Type the name of the application and select Portlet Producer Application from the list with application templates.
On the next screen give the project a name. JDeveloper already selected the minimum needed project technologies and libraries needed to be included into the project.
On the next screen you can type the default package name and click Finish to finish this project creation.
Now as you can see the JDeveloper create empty producer application for you. You can use now this to create your JSR 286 into.
To do so go and click with the right mouse button on the application and click on New.
In the newly opened window select Portlets and then Standard-based Java Portlet (JSR 286) to create new portlet.
This will open a new window, where now you can set up you portlet. Since this is just a example I will leave everything by default.
Just click always Next until the last step and then on finish to complete the creation. All setting you see into the wizard are changeable later, so you do not have to worry about this now. I will try to show you how to do this in another article.
Now when you finish the creation you will see something like this:
You create your fist portlet, which is ready to run. To run the portlet click with the right mouse button into your portlet and then on Run. This will deploy your portlet and then start it automatically into your default browser.
So that you will something like this in your browser:
If you want to open the view.jsp page you can go for the link: http://127.0.0.1:7101/Portlets-PortletsOtn-context-root/portlet1/html/view.jsp
or you can just click on the view.jsp with the right mouse button and select Run again. This will open the view page directly into your browser:
Step 3: Adding more portlets to the current project.
If you want to add more portlets to this project you do the following:
Right mouse click on the portlet.xml file and from the menu click on Add Portlet.
This opens the already familiar window with the portlet settings but now for the new portlet you want to add into the current application. I will leave the setting again by default and click on next and then finish until I create the project.
After you finish with the wizard your JDeveloper project will look now like this:
The wizard added now one more portlet into the current project. If you run the project again you will into your browser now the following:
The JDeveloper exported the two portlets WSDL and there are ready to be consumed from portal supporting WSRP. Having this we now register our portlets into the WebCenter Portal.
Step 4: Registering the portlets into the WebCenter Portal
There are two ways to register the portlets into the WebCenter Portal:
- In Design Mode – this step is done in JDeveloper when you create and design your portal.
- In Running Mode – when your portal is packed and deployed on separated environment.
I would like to show you how to register the newly created portlets in Running Mode. Open your portal and login in as administrator.
Click on Administration to go into the admin section and then click on Services->Portlet Producer as shown bellow:
Now click on Register and you will see the registration form:
Where you can choose the producer name, the producer type which in our case is WSRP-Producer and then the WSDL URL. To get the URL you have to go to your portlet info page and click on WSRL v2 WSDL link,
which will open the URL into the browser like this:
this is the URL which you have to use as WSDL URL when you register the portlet. On the end click on OK to finish the registration. You portlets now should be accessible and you can add them to a page from the portlet catalog shown bellow:
and then here
Now those were very simple steps but initial and important to start your portlet development. In the next article I would try to go more in details about how to use the different JSR 286 functions together with JDeveloper.