Search This Blog

Friday, October 5

Creating a Sample Portal project

Creating a Portal project:
Open the developer studio.
1) Create a New Project. File -> New -> Project -> Portal Application.
2) Select 'Create a Portal Application project' and click Next.
3) Specify project name as 'MyFirstPortalProject' and project root folder can remain default as it is. Click Finish. The created project is displayed in Package Explorer.
4) Right click the project and select New -> Other -> Portal Application. Choose 'Create a new Portal Application Object' on the right side. Click Next.
5) Choose MyFirstPortalProject and click Next.
6) In the next page, click the + sign near 'Portal Component' to expand. Select JSPDynPage and click Next.
7) Specify name for JSPDynPage.
Name: FirstJSPDynPage
Location: Core
JSPDynPage class name: FirstJSPDynPage
JSPDynPage package name: com.mysap.pages
JSP: firstjsp
Click Next.
8) In the next page, choose 'Generate bean statements'
Bean name: myBean
Bean scope: application
Choose 'Generate bean class' radio button.
Location: Core
Class name: UserBean
Package name: com.mysap.bean
Click Finish.
You can see, and firstjsp.jsp created.
  • is the bean class - model
  • is the dynpage class - servlet
  • firstjsp.jsp is the jsp - view
Now we will first create UI in JSP, do some eventing and then use model to store and retrieve values.
Creating UI screen:
Open firstjsp.jsp. This has two tabs at the bottom. Click on Source tab. Since we are going to use htmlb tags for creating UI elements, we have to add taglib for htmlb in the jsp and its reference in portalapp.xml.
In JSP, add in the first line.
<%@ taglib uri= "tagLib" prefix="hbj" %>
Open portalapp.xml from MyFirstPortalProject -> dist -> PORTAL-INF. Go to Source tab. Replace with this.

"tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
Now open JSP and continue adding tags for creating a textview, input field and a button. Place them in grid layout for arranging them in the same row.
Here is the source code. I am not including since as of now, there are no changes made in it.
<%@ taglib uri= "tagLib" prefix="hbj" %>
"myBean" scope="application" class="com.mysap.bean.UserBean" />
"myContext" >
"myFormId" >



text="User Name"




tooltip="Submit Button"


name="PrivateSharingReference" value=""/>


name="ClassName" value="com.mysap.pages.FirstJSPDynPage"/>
name="ComponentType" value="jspnative"/>
name="JSP" value="pagelet/firstjsp.jsp"/>

name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>

Configure Enterprise Portal in NWDS:
Make sure Enterprise portal server is configured in studio. If not, go to Window Menu -> Preferences. Choose SAP Enterprise Portal. Click Add button.
Alias: ABC
Host: pc014235
Port: 50000
Login: john
Description: ABC
Click Ok. Then choose checkbox on the left of this server as default server for deploying portal applications. Click Apply and Ok.
Host and port refer to host name of the server and port in which the portal server runs. Alias can be used to differentiate if there are more than one server instance on the same host. Description can be any text about server. Logon is the portal user id which is used to deploy portal applications to server.
Build Project:
You need to build project before deploying. Right click on the project -> Build project.
If any of the imports are missing, you can add them. Here, two jars may be required for htmlb classes if you get red marks (which means error for missing imports here) in FirstJSPDynPage class.
Right click project -> Properties -> Java Build Path -> 'Libraries' tab -> Click on 'Add External Jars' and add these two jars.
1) - C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\
2) htmlb.jar - C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\\comp\SAP_JTECHS\DCs\\com.sapportals.htmlb_comp\gen\default\public\default\lib\java
Click Ok and rebuild the project.
Note: The path of the jars may change depending on the developer studio location and version.
Deploy Project:
We can now deploy the project to the portal server.
Right click project -> Export -> Par File -> MyFirstPortalProject.
PAR file will be coming automatically corresponding to this project.
Check the box for 'Deploy PAR'.
In the table below, click on password cell and enter the password. Click Finish.
The project is deployed to server.
To check the output, go to portalapp.xml -> Overview tab.
Click Run button near the DynPage component, which is 'FirstJSPDynPage' in our case. This will launch the browser for portal. Enter password for authentication. You can then view the output.

related posts:
Knowledge management component of SAP Enterprise portal
Implementing external facing portal
Creation of custom navigation connector
Navigation in sap enterprise portal
Trust between sap ep and backend system
J2ee course content it training
It training sap training ear training
Java api to retrieve work sets assigned
Could not find system alias
Sap ep web dynpro java error srm portal
Unsupportedclassversionerror in sap
Sap ep 73 upgrade related error