You are on page 1of 62

Developing JSF 2.

0 Portlet Applications using RichFaces with
Rational Application Developer 8.5

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

Table of Contents
Abstract......................................................................................................................................................3
Overview....................................................................................................................................................3
Sample application ....................................................................................................................................3
Develop the sample application ................................................................................................................4
Create a Faces Library Definition.........................................................................................................4
Portlet Project and Portlet Creation.......................................................................................................6
Develop Market Watch Portlet.................................................................................................................10
Create scoped managed bean...............................................................................................................11
Custom code specific to the application....................................................................................16
Develop GUI using RichFaces widgets...............................................................................................17
Develop Trading Portlet...........................................................................................................................19
Create scoped managed bean..............................................................................................................24
Custom code specific to the application....................................................................................24
Custom code specific to the application....................................................................................26
Develop GUI using RichFaces widgets...............................................................................................26
Develop Portfolio Portlet.........................................................................................................................34
Create scoped managed bean..............................................................................................................34
Custom code specific to the application....................................................................................35
Custom code specific to the application....................................................................................35
Develop GUI using RichFaces widgets...............................................................................................35
Develop Watchlist portlet.........................................................................................................................38
Create scoped managed bean..............................................................................................................39
Custom code specific to the application....................................................................................39
Custom code specific to the application....................................................................................39
Develop GUI using RichFaces widgets...............................................................................................40
Deploy application on WebSphere Portal server......................................................................................43
Execute the application on the server.......................................................................................................45
Market Watch Portlet...........................................................................................................................45
Trading Portlet ....................................................................................................................................46
Portfolio Portlet...................................................................................................................................49
Watchlist Portlet..................................................................................................................................50
Buy and Sell Operations............................................................................................................50
Buy Operation from Trading Portlet.................................................................................51
Sell Operation from Trading Portlet.................................................................................55
Watch operation from Trading portlet .......................................................................................59
Remove transactions from Watchlist portlet..............................................................................61
Conclusion...............................................................................................................................................62
References................................................................................................................................................62

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

Abstract
The article illustrates the procedure to create and publish a JSF 2.0 portlet project using RichFaces widget
library, on IBM WebSphere Portal v8.0 server using IBM Rational Application Developer. A sample Market
Snapshot application, showcases the usage of JSF 2.0 features in a JSR 286 portlet application. Detailed
instructions in the article shows development of key JSF 2.0 features, such as annotations, Ajax, and resource
loading.

Overview
Java Server Faces(JSF) is a popular technology to build web and portal applications these days. Rich UI and
features provided by the third party component libraries of JSF gives an extra edge to the applications. This
article considers one such library – RichFaces. It demonstrates how you can use an ensemble of JSF and
WebSphere Portal technologies to build powerful and compelling portal applications.
Prerequisites
1. IBM® Rational® Application Developer version 8.5
2. IBM WebSphere Portal Server version 8.0
3. RichFaces version 4.1.0

Sample application
The Stock Market sample application is a JSF v2.0 based JSR 286 portlet application for a financial domain. The
application comprises of four portlets:
• Market Watch – This portlet displays latest market trends from different stock exchanges. It also shows
intra-day graphs for the exchanges.
• Trading – This portlet searches, buys, sells and adds stocks to the watchlist from different exchanges.
Go to help mode of Trading portlet to check the list of stocks in the database.
• Portfolio – This portlet displays portfolio stocks in an account. You can buy or sell the stocks from
Portfolio portlet as well.
• Watchlist – This portlet displays list of stocks that are on the watch list of an account. You can buy, sell,
or remove the stocks from the watch list.
This sample application leverages the JSF 2.0 features and demonstrates how the following technology features
are consumed in the portlet application using intuitive tools available with IBM® Rational® Application Developer
version 8.5
• Ajax
• Annotations
• Composite components
• Implicit Navigation
• Resource loading
• Template

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

Start by creating a Library Definitions Project to contain the library's configuration metadata. INCLUDING. RichFaces Components).Develop the sample application Create a Faces Library Definition To develop the sample application. BUT NOT LIMITED TO. modifying or distributing the sample program or its derivatives. which is used as a third-party component library. IBM shall not be liable for any damages you suffer as a result of using. Select File > New > Project > Web > Library Definitions Project to display the Library Definitions Project wizard. Figure 1.jboss. Enter the project a name (in this case. so the above limitations or exclusions may not apply to you. . 1. as shown in Figure 1. download the RichFaces component Java™ archive (JAR) file from the RichFaces Web site (http://www. Click Finish. 2.org/richfaces/download). IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Create a Faces Definitions Project AltText: The page of the new Library Definitions project wizard The sample program is provided to you on an "AS IS" basis. EITHER EXPRESS OR IMPLIED. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. without warranty of any kind.

Enter the new definition a name (for example. After analyzing the RichFaces JAR file and generating files. 3. rich). EITHER EXPRESS OR IMPLIED.jar) that you downloaded from the RichFaces site. the wizard opens the new JLD configuration file (rich.tld) in the editor. Create a new Faces Library Definition AltText: The first page of the new faces library definitions wizard 2. The sample program is provided to you on an "AS IS" basis.Final. Click Finish. Click the browse button next to the Jar file field and select the location of the JAR file(richfacescomponents-ui-4. When the portlet project created and facelet page opens in the editor. modifying or distributing the sample program or its derivatives. IBM shall not be liable for any damages you suffer as a result of using. BUT NOT LIMITED TO.1.jld and a4j. so the above limitations or exclusions may not apply to you. Figure 2. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. . without warranty of any kind. INCLUDING. as shown in Figure 3. as shown in Figure 2. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. 1. the new RichFaces drawer in the palette view.To create a library definition for the RichFaces library and examine its elements: Right-click the new project that you just created and select New > Faces Library Definition. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.0.

3. The sample program is provided to you on an "AS IS" basis. without warranty of any kind. Specify the portlet name as Market Watch. EITHER EXPRESS OR IMPLIED. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. modifying or distributing the sample program or its derivatives. Create a portlet check box is selected by default. so the above limitations or exclusions may not apply to you. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. IBM shall not be liable for any damages you suffer as a result of using. . In the Portlet settings group. INCLUDING. Select File > New > Project > Portlet Project to display the project wizard. Enter StockSample_Richfaces as the portlet project name.Figure 3: Palette with RichFaces components AltText: Available RichFaces components in Palette view Portlet Project and Portlet Creation Now create a JSF 2. 1. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. BUT NOT LIMITED TO. 2.0 portlet project and see how the new component library integrates with the JSF tools.

. as shown in Figure 4. Figure 4: Portlet Project Creation Wizard AltText: The first page of the new portlet project wizard The sample program is provided to you on an "AS IS" basis.4. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives. INCLUDING. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. without warranty of any kind.0 as the Target Runtime. Select WebSphere Portal v8. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. BUT NOT LIMITED TO.

• Repeat these steps to add the other two portlets: Portfolio and Watchlist. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. BUT NOT LIMITED TO. When prompted. A portlet project and the corresponding EAR is created. The sample program is provided to you on an "AS IS" basis. so the above limitations or exclusions may not apply to you. • Enter the portlet name as Trading. and click Finish. 6. switch to the Web perspective. Given that the sample application covers four portlets. INCLUDING. Click OK. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. without warranty of any kind.5. . Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Click Finish. To add portlets to the portlet project: • Right-click the portlet deployment descriptor node and select New > Portlet. Click Modify button beside Configuration to display the Portlet Project Configuration wizard. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. IBM shall not be liable for any damages you suffer as a result of using. Figure 5: Select Portlet API and type AltText: Select Portlet API and Portlet Type 7. Select JSR 286 API and Faces as the Portlet Type. Add all the portlets to the portlet application. as shown in Figure 5. and displayed in the Enterprise Explorer view. 8.

you will use EXtensible Markup Language (XML). • • • • exchange. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.1. . IBM shall not be liable for any damages you suffer as a result of using.1. without warranty of any kind.jar • richfaces-components-api-4.9. Copy the following XML files (from the WebContent folder in the attached sample) to the WebContent folder of the project. INCLUDING. modifying or distributing the sample program or its derivatives.0.1.jar • sac-1.5.0. as shown in Figure 7: • WebContent\resources\img Figure 7: Location of images AltText: Folder stucture for resources in the project.0.Final.xml watchlist.xml RichFaces configuration for portlet project Copy the following RichFaces libraries into \WebContent\WEB-INF\lib folder.jar • guava-10.jar • cssparser-0.jar The sample program is provided to you on an "AS IS" basis.Final.jar • richfaces-core-impl-4. EITHER EXPRESS OR IMPLIED.9. which is in lightweight interchange format. and presents data which is easy to parse and is in human readable form. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.0. In this application. Create following folder structure and copy all images (copy the files from the WebContent\resources folder in the sample attached with this article) to the folders respectively.xml portfolio.1. The added libraries are: • richfaces-components-ui-4.Final. so the above limitations or exclusions may not apply to you. The data provided by the XML file is copied to the data table.3. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.1. BUT NOT LIMITED TO.0.xml trading.Final.jar • richfaces-core-api-4.

INCLUDING. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. BUT NOT LIMITED TO. creates a managed bean with the properties for the columns shown in the table. so the above limitations or exclusions may not apply to you. IBM shall not be liable for any damages you suffer as a result of using. Thus.Develop Market Watch Portlet This portlet shows the trends for different exchanges and has an intra-day graph. modifying or distributing the sample program or its derivatives. without warranty of any kind. EITHER EXPRESS OR IMPLIED. It also shows the details of the various exchanges in a tabular form. . Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Figure: Market Watch Portlet AltText: MarketWatch portlet as seen on browser The sample program is provided to you on an "AS IS" basis.

Create a Java class using New->Class from the context menu of Java Resources in the portlet project as shown in Figure 8. . BUT NOT LIMITED TO. without warranty of any kind. Enter the name as Exchange. The sample program is provided to you on an "AS IS" basis. IBM shall not be liable for any damages you suffer as a result of using. INCLUDING. 1.Create scoped managed bean Steps below illustrate the creation of managed bean using annotations in Rational Application Developer. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. EITHER EXPRESS OR IMPLIED. so the above limitations or exclusions may not apply to you. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. modifying or distributing the sample program or its derivatives.

INCLUDING. . Some jurisdictions do not allow for the exclusion or limitation of implied warranties. IBM shall not be liable for any damages you suffer as a result of using. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. so the above limitations or exclusions may not apply to you. BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED. without warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.Figure 8: Create a Managed Bean AltText: Creation of managed bean class The sample program is provided to you on an "AS IS" basis.

modifying or distributing the sample program or its derivatives.Serializable. Add the following annotations to the class. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.faces. as shown in Code Snippet 2: Code Snippet 2 private private private private String name.RequestScoped. Now add the class variables and constants for the managed bean.gif". Some jurisdictions do not allow for the exclusion or limitation of implied warranties.gif". EITHER EXPRESS OR IMPLIED. private private private private static static static static final final final final String String String String RED_COLOUR = "#FF0000". float lastPrice. DOWN_ARROW = "arrow_down_red. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. String percentChange.ManagedBean. INCLUDING. import javax. GREEN_COLOUR = "#006400". BUT NOT LIMITED TO.faces. which define this class as a request scoped managed bean. so the above limitations or exclusions may not apply to you.bean. The request scope managed bean implements the Serializable interface.bean. . without warranty of any kind. UP_ARROW = "arrow_up_green. import javax.2. as shown in Code Snippet 1: Code Snippet 1 import java. String change.io. The sample program is provided to you on an "AS IS" basis. IBM shall not be liable for any damages you suffer as a result of using. @ManagedBean(name="exchange") @RequestScoped public class Exchange implements Serializable { 3.

as shown in Figure 9. Right-click in the file and select Source->Generate Getters and Setters. INCLUDING. EITHER EXPRESS OR IMPLIED. without warranty of any kind. to generate the getters and setters. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.4. Figure 9: Generate Getters and Setters AltText: Getters and setters for managed bean properties The sample program is provided to you on an "AS IS" basis. . BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. IBM shall not be liable for any damages you suffer as a result of using.

Figure 10: Generate Constructor using Fields AltText: Generation of constructor in the class The sample program is provided to you on an "AS IS" basis. Right-click in the file and select Source->Generate Constructor using Fields to generate the constructor with fields for managed bean. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.5. modifying or distributing the sample program or its derivatives. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. BUT NOT LIMITED TO. INCLUDING. . as shown in Figure 10. without warranty of any kind. so the above limitations or exclusions may not apply to you.

Add parseXML() method to read the sample data from the XML file. EITHER EXPRESS OR IMPLIED. The sample program is provided to you on an "AS IS" basis. private static final String EXCHANGE_FILE = "/exchange. See the ExchangeList. See the ExchangeList. as shown in Code Snippet 1. as shown in Code Snippet 3: Code Snippet 3 private ArrayList<Exchange> exchange. BUT NOT LIMITED TO. without warranty of any kind. 4. modifying or distributing the sample program or its derivatives. font color based on profit and loss in the change column.java file. 6. IBM shall not be liable for any damages you suffer as a result of using. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.java file (in the attached sample) for the details of these methods. that is Exchange. 5. INCLUDING. Give managed bean name as exchangeList. setGraphImage(). which is needed to get the color of the arrow showing the trends. getGraphImage(). Some jurisdictions do not allow for the exclusion or limitation of implied warranties.Custom code specific to the application To customize the portlets and add exchange specific display to the Stock application. 2.java. Add getExchange().java file (in the attached sample) for the details of this method. updateGraphImage() methods in ExchangeList. Add the following variables in the ExchangeList. 3. . add the following methods: 1. Similarly create another annotated managed bean and name it as ExchangeList. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Add getPercentChangeFontColor().java (in the attached sample) for the details of this method. so the above limitations or exclusions may not apply to you. getImage() methods in the managed bean class.xml". Add annotations to the class. See Exchange. setStocks().java to display the default and updated values in the lineChart.

THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. modifying or distributing the sample program or its derivatives. Specify the name of the Image by clicking the browse button in the name field. 4. Note that the dataTable tag is added to the page. as shown in Figure 11: Figure 11: Image Properties AltText: Set properties for the image The image tag is as shown in Code Snippet 4: Code Snippet 4 <h:graphicImage styleClass="graphicImage" id="image1" name="#{exchangeList. Drag the item dataTable from rich drawer of the Palette view onto the facelet (MarketWatchView.name}" The sample program is provided to you on an "AS IS" basis. Open the MarketWatchView. Select #{exchangeList. 2. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.graphImage} as name of the Image."> <rich:column id="column1"> <f:facet name="header"> <h:outputText value="Exchange" style="font-size: small. INCLUDING. IBM shall not be liable for any damages you suffer as a result of using. Add columns as shown in Code Snippet 5: Code Snippet 5 <rich:dataTable id="dataTableRenderer1" var="exchange" value="#{exchangeList.xhtml) file.xhtml) file. BUT NOT LIMITED TO. Right-click the Image and select Properties.xhtml file and drag Image item from the Standard Faces Components drawer of the Palette view onto the facelet (MarketWatchView. Click OK to add RichFaces into the portlet project. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.graphImage}" library="img"></h:graphicImage> 3. EITHER EXPRESS OR IMPLIED.exchange}" style="width: 435px" noDataLabel="No records found. . float: left" /> </f:facet> <a4j:commandLink id="commandLinkRenderer1" value="#{exchange. without warranty of any kind. A dialog box appears to copy the new project resources. so the above limitations or exclusions may not apply to you.Develop GUI using RichFaces widgets 1.

xhtml) file to add columns . float: right" /> </f:facet> <h:outputText value="#{exchange. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.Last Index.color: #{exchange.percentChangeFontColor}"></h:outputText> </rich:column> The sample program is provided to you on an "AS IS" basis.updateGraphImage}"> <a4j:param name="name" value="#{exchange. INCLUDING.color: #{exchange. Select properties and set the values for the columns as Exchange.name}" assignTo="#{exchange.lastPrice}" style="float: right.name}. Last Index.color: #{exchange. To set the value. #{exchange. without warranty of any kind. select each column of data table and right-click. float: right" /> </f:facet> <h:outputText value="#{exchange.percentChangeFontColor}"></h:outputText> </rich:column> <rich:column id="column3"> <f:facet name="header"> <h:outputText value="Change" style="font-size: small.change} and #{exchange. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives. Change and %Change as #{exchange.image}" library="img" style="float: right"></h:graphicImage> <h:outputText value="#{exchange. and % Change.style="font-weight: bold" render="form1:image1" action="#{exchangeList.lastPrice}.percentChange}%" style="float: right. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. #{exchange. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. . BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED. float: right" /> </f:facet> <h:graphicImage styleClass="graphicImage" id="image2" name="#{exchange. Change. Drag column item from the rich drawer of the Palette view onto the facelet (MarketWatchView.name}"></a4j:param> </a4j:commandLink> </rich:column> </rich:dataTable> 5.percentChange}% respectively as shown in Code Snippet 6: Code Snippet 6 <rich:column id="column2"> <f:facet name="header"> <h:outputText value="Last Index" style="font-size: small.change}" style="float: right.percentChangeFontColor}"></h:outputText> </rich:column> <rich:column id="column4"> <f:facet name="header"> <h:outputText value="% Change" style="font-size: small.

Figure: Trading Portlet View AltText: Trading Portlet as seen on browser 1. so the above limitations or exclusions may not apply to you. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Select Portlet Facelet in New Web Page wizard. Click Finish. 2. 3. INCLUDING.Develop Trading Portlet This portlet is used to get the quotes for the stocks. . Enter the File Name as template as shown in Figure 12. The sample program is provided to you on an "AS IS" basis. IBM shall not be liable for any damages you suffer as a result of using. without warranty of any kind. Select New->Web Page from the context menu of the portlet project. BUT NOT LIMITED TO.

. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. INCLUDING. without warranty of any kind. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. EITHER EXPRESS OR IMPLIED. so the above limitations or exclusions may not apply to you. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. modifying or distributing the sample program or its derivatives. IBM shall not be liable for any damages you suffer as a result of using.Figure 12: New Web Page Wizard to add template AltText: Facelet page for a template The sample program is provided to you on an "AS IS" basis. BUT NOT LIMITED TO.

Select New->Web Page from the context menu of the portlet project and click Options to create a new portlet facelet page with the template that you created.4. . BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using.xhtml) file. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Drag the Insert from the Facelet drawer of the Palette view onto the facelet (template. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives. INCLUDING. The sample program is provided to you on an "AS IS" basis. Enter the name as bodyarea for the insert tag in the Properties view as shown in Figure 13: Figure 13: Template Page AltText: Set properties for the Insert 5. without warranty of any kind.

6.

Select Portlet Facelet in New Web Page Options wizard and select Set as initial page. Click Close, as
shown in Figure 14.

Figure 14: New Web Page Options

AltText: New web page options

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

7.

Select template.xhtml file from MyTemplates and click Finish, as shown in Figure 15:

Figure 15: TradingPortletView Page

AltText: Selection of template for the page

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

Create scoped managed bean
1.
2.
3.
4.

Create a Java class as shown in Figure 8. Specify the name as TradingService.
Add annotations to the class, as shown in Code Snippet 1.
Enter the managed bean name as tradingService.
Add the class variables and constants for the managed bean, as shown in Code Snippet 7:

Code Snippet 7
@ManagedProperty(value = "#{param.exchangename}")
private String exchangename;
@ManagedProperty(value = "#{param.stockname}")
private String stockname;
@ManagedProperty(value = "#{param.portletname}")
private String portletname;
private
private
private
private

String
String
String
String

lastPrice;
percentChange;
dataExists = "hidden";
message;

private static final String PORTFOLIO_FILE = "/portfolio.xml";
private static final String TRADING_FILE = "/trading.xml";
private static final String WATCHLIST_FILE = "/watchlist.xml";
5.

Right-click in file and select Source->Generate Getters and Setters. to generate the getters and setters
for the added classes, as shown in Figure 9.

Custom code specific to the application
To customize the portlets and add trading specific service to the Stock application, add the following methods.
See the TradingService.java (in the attached sample) file for the details about the added methods.
1.
2.
3.
4.
5.
6.
7.
8.

Add getQuotes(), getSelectedStock() methods to get the data for the selected stock.
Add buyPage(), sellPage(), goBack() methods to navigate to Buy and Sell page respectively.
Add buyStock() method to buy the stock and add details of that stock in XML file.
Similarly add sellStock() method to sell the stock and update details of that stock in XML file.
Now add addToWatch() method to add the selected stocks in your watchlist.
Create a Java class as shown in Figure 8. Specify the name as StockBean.
Add annotations to the class, as shown in Code Snippet 1. Give managed bean name as stockBean.
Now add the class variables for the managed bean, as shown in Code Snippet 8:

Code Snippet 8
private String exchangename;
private String stockname;
private String lastPrice;

The sample program is provided to you on an "AS IS" basis, without warranty of any kind.
IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow for the exclusion or limitation of implied warranties, so the above limitations or
exclusions may not apply to you. IBM shall not be liable
for any damages you suffer as a result of using, modifying or distributing the sample program or its derivatives.

12. this.stockname}") private String stockname. 14. without warranty of any kind.java. so the above limitations or exclusions may not apply to you. font color based on profit and loss in the % change and last price columns. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.stockname = stockname. needed to get the color of the arrow showing the trends.exchangename}") private String exchangename. @ManagedProperty(value = "#{param. Right-click in the file and select Source->Generate Constructor using Fields to generate the constructor with fields for managed bean. Right-click in the file and select Source->Generate Getters and Setters to generate the getters and setters as shown in Figure 9. Now add the class variables for the managed bean. @ManagedProperty(value = "#{param. as shown in Code Snippet 1.exchangename = exchangename. EITHER EXPRESS OR IMPLIED. Add getImage(). IBM shall not be liable for any damages you suffer as a result of using. BUT NOT LIMITED TO. Right-click in the file and select Source-> Generate Getters and Setters. String lastPrice. String percentChange) { this. private String visibility = "visible".percentChange = percentChange. 10. 13. . Specify the name as BuySellBean. @ManagedProperty(value = "#{param. INCLUDING.portletname}") private String portletname. Add annotations to the class. this. 15. as shown in Figure 10. @ManagedProperty(value = "#{param. Create a Java class as shown in Figure 8. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. StockBean. See the code generated in Code Snippet 9: Code Snippet 9 public StockBean(String exchangename. getPercentChangeFontColor() methods in the managed bean class that is. Give managed bean name as buySellBean. as shown in Figure 9. } 11. as shown in Code Snippet 10: Code Snippet 10 @ManagedProperty(value = "#{param.quantity}") private String quantity. String stockname.price}") private String price. to generate the getters and setters. this. 9. See StockBean.lastPrice = lastPrice.private String percentChange. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.java (in the attached sample) for the details of this method. The sample program is provided to you on an "AS IS" basis.

Some jurisdictions do not allow for the exclusion or limitation of implied warranties. and set the properties as shown in Figure 16: Figure 16: Properties view Facelet Composite AltText: Specify properties for output text in facelet composite.xhtml). IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. INCLUDING. 2. The sample program is provided to you on an "AS IS" basis. You can add the composite component to different pages. without warranty of any kind. To add composite components: 1. as shown in Figure 12.Custom code specific to the application To customize the portlets and add stock trade confirmation services to the Stock application. Develop GUI using RichFaces widgets In this application composite component helps to display faces messages in the page. modifying or distributing the sample program or its derivatives. EITHER EXPRESS OR IMPLIED.xhtml. wherever these messages are required. and name it as message. See BuySellBean. sellConfirmPage() methods to navigate to the confirmation page of buy and sell operations. so the above limitations or exclusions may not apply to you. IBM shall not be liable for any damages you suffer as a result of using. add buyConfirmPage().java (in the attached sample) file for the details of this method. Drag Output from the Standard Faces Components drawer onto the facelet(message. . BUT NOT LIMITED TO. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Create a Facelet composite page.

3. . IBM shall not be liable for any damages you suffer as a result of using. INCLUDING. Drag Output from the Standard Faces Components drawer onto the facelet (TradingPortletView.xhtml file. without warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. so the above limitations or exclusions may not apply to you. BUT NOT LIMITED TO.xhtml) and set the properties. Open the TradingPortletView. and insert the composite component. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. as shown in Figure 17: Figure 17: Facelet Composite in palette AltText: composite option the palette view 4. Drag message from the Facelet Composites drawer onto the facelet. as shown in Figure 18: Figure 18: Properties view output text The sample program is provided to you on an "AS IS" basis.

Set the choices and the Value from the Properties view.AltText: Properties view for output text used as a label 5.xhtml) and name it as Exchange. Drag Label from the Standard Faces Components drawer inside panel grid onto the facelet (TradingPortletView. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. without warranty of any kind. 7. to select from. . modifying or distributing the sample program or its derivatives. INCLUDING. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.xhtml).xhtml) and set the properties.exchangename}. as shown in Code Snippet 11: Code Snippet 11 <h:outputLabel value="Exchange: " styleClass="outputLabel" id="label1" for="menu1" style="font-weight: bold. so the above limitations or exclusions may not apply to you.exchangename}" defaultLabel="SAUAGA"> <f:selectItem itemLabel="SAUAGA" itemValue="SAUAGA" id="selectItem1" <f:selectItem itemLabel="JASSIN" itemValue="JASSIN" id="selectItem2" <f:selectItem itemLabel="MANANE" itemValue="MANANE" id="selectItem3" <f:selectItem itemLabel="MANGAB" itemValue="MANGAB" id="selectItem4" <f:selectItem itemLabel="MEGKUC" itemValue="MEGKUC" id="selectItem5" </rich:select> /> /> /> /> /> The sample program is provided to you on an "AS IS" basis. as shown in Figure 19: drawer onto the facelet Figure 19: Panel Grid AltText: Properties set for Panel Grid 6. Select properties and set the value as #{tradingService. font-size: small"></h:outputLabel> <rich:select id="menu1" value="#{tradingService. Drag select from the rich drawer inside panel grid onto the facelet (TradingPortletView. To set the value. BUT NOT LIMITED TO. Drag Panel Grid from the Standard Faces Components (TradingPortletView. select select component and right-click. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. It is needed to view the list of exchanges.

IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. BUT NOT LIMITED TO. . EITHER EXPRESS OR IMPLIED. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.8. so the above limitations or exclusions may not apply to you. Drag Label named Stock: from the Standard Faces Components drawer onto the facelet (TradingPortletView. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. modifying or distributing the sample program or its derivatives.xhtml) and add a inplaceInput from the rich drawer with the properties set as shown in Figure 20: Figure 20: TradingService stockname properties AltText: Properties set for InplaceInput text The sample program is provided to you on an "AS IS" basis. INCLUDING. IBM shall not be liable for any damages you suffer as a result of using. without warranty of any kind.

BUT NOT LIMITED TO."> <rich:column> <f:facet name="header"> <h:outputText styleClass="outputText" value="Name" style="font-size: small. Drag commandButton from the rich drawer of the Palette view. as shown in Figure 21: Figure 21: Command Button Properties view AltText: Properties set for Command Button 10.9. modifying or distributing the sample program or its derivatives. Set the action of the commandButton to the getQuotes method. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM shall not be liable for any damages you suffer as a result of using.xhtml). without warranty of any kind. INCLUDING. Drag dataTable item from the rich drawer onto the facelet columns as shown in Code Snippet 12: (TradingPortletView. float: left"></h:outputText> </f:facet> <h:outputText styleClass="outputText" value="#{stock. and add the Code Snippet 12 <rich:dataTable var="stock" value="#{tradingService.dataExists}" noDataLabel="No records found. . IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. so the above limitations or exclusions may not apply to you.selectedStock}" id="table1" style="margin-left: 5px. next to Stock to get the quote based on the stock entered. EITHER EXPRESS OR IMPLIED. width: 350px.stockname}"></h:outputText> </rich:column> The sample program is provided to you on an "AS IS" basis. visibility: #{tradingService.

stockname}"></f:param> <f:param name="portletname" value="trading"></f:param> </h:commandLink> </rich:column> <rich:column id="column5"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: right"></h:outputText> </f:facet> <h:commandLink value="Sell" styleClass="commandLink" id="link4" The sample program is provided to you on an "AS IS" basis. Drag column item from the rich drawer onto the facelet (TradingPortletView. sell.buyPage}" style="float: right"> <f:param name="exchangename" value="#{stock.image}" library="img" style="float: right"></h:graphicImage> <h:outputText styleClass="outputText" value="#{stock.color:#{stock. and watch the stocks. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. float: right"></h:outputText> </f:facet> <h:graphicImage styleClass="graphicImage" id="image1" name="#{stock. BUT NOT LIMITED TO. Select properties and set the values for the columns as shown in Code Snippet 14: Code Snippet 14 <rich:column id="column4"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: right"></h:outputText> </f:facet> <h:commandLink value="Buy" styleClass="commandLink" id="link3" action="#{tradingService.percentChangeFontColor}"></h:outputText> </rich:column> 12. Add three columns to the data table with command links to buy. select each column of data table and right-click. IBM shall not be liable for any damages you suffer as a result of using. . so the above limitations or exclusions may not apply to you. To set the value.lastPrice}" style="float: right. Select properties and set the values for the columns as shown in Code Snippet 13: Code Snippet 13 <rich:column id="column2"> <f:facet name="header"> <h:outputText value="Last Price" styleClass="outputText" style="font-size: small.exchangename}"></f:param> <f:param name="stockname" value="#{stock.percentChangeFontColor}"></h:outputText> </rich:column> <rich:column id="column3"> <f:facet name="header"> <h:outputText value="% Change" styleClass="outputText" style="font-size: small. EITHER EXPRESS OR IMPLIED.percentChange}%" style="float: right. To set the value. INCLUDING.xhtml) file to add columns Last Price and % Change and set their value.color:#{stock.</rich:dataTable> 11. without warranty of any kind. select each column of data table and rightclick. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. float: right"></h:outputText> </f:facet> <h:outputText styleClass="outputText" value="#{stock. modifying or distributing the sample program or its derivatives.

as shown in Figure 12. INCLUDING.exchangename}"></f:param> <f:param name="stockname" value="#{stock. EITHER EXPRESS OR IMPLIED.sellPage}" style="float: left"> <f:param name="exchangename" value="#{stock. Figure 22: Trading Help page content AltText: Trading Portlet Help page contents The sample program is provided to you on an "AS IS" basis. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.stockname}"></f:param> <f:param name="portletname" value="trading"></f:param> </h:commandLink> </rich:column> <rich:column id="column6"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: left"></h:outputText> </f:facet> <h:commandLink value="Watch" styleClass="commandLink" id="link5" action="#{tradingService. For this.exchangename}"></f:param> <f:param name="stockname" value="#{stock. BUT NOT LIMITED TO.action="#{tradingService. Add Help mode to display the list of stock and exchange names that are used to get the quotes in the TradingPortletView page. See the sample for details of this page. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.stockname}"></f:param> </h:commandLink> </rich:column> 13.xhtml. so the above limitations or exclusions may not apply to you. . create a Portlet Facelet page name as TradingHelp. modifying or distributing the sample program or its derivatives. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Add content same as shown in the Figure 22. 14.addToWatch}" style="float: left"> <f:param name="exchangename" value="#{stock. IBM shall not be liable for any damages you suffer as a result of using. without warranty of any kind.

BUT NOT LIMITED TO. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. without warranty of any kind. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you.xml The sample program is provided to you on an "AS IS" basis.15. modifying or distributing the sample program or its derivatives. INCLUDING. Add a parameter init-param to the Initialization section under the Portlets tab for Trading portlet as shown in Figure 23: Figure 23: Portlet tab Initialization section AltText: Help page init-param in portlet. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .

quantity. UP_ARROW = "arrow_up_green. Figure: Portfolio Portlet AltText: Portfolio portlet as seen on browser Create scoped managed bean 1. Give the name as Portfolio. as shown in Code Snippet 15: Code Snippet 15 private private private private private String String String String String exchangename. INCLUDING. that is the list of the stocks that are bought.gif". stockname. . 3. private private private private static static static static final final final final String String String String RED_COLOUR = "#FF0000".gif".Develop Portfolio Portlet The Portfolio portlet displays the stocks in a trading account portfolio. modifying or distributing the sample program or its derivatives. GREEN_COLOUR = "#006400". DOWN_ARROW = "arrow_down_red. buyPrice. Give managed bean name as portfolio. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Create a Java class as shown in Figure 8. Now add the class variables and constants for the managed bean. Add annotations to the class. as shown in Code Snippet 1. BUT NOT LIMITED TO. currentPrice. so the above limitations or exclusions may not apply to you. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Create a managed bean for the Portfolio portlet to hold the required data. without warranty of any kind. EITHER EXPRESS OR IMPLIED. IBM shall not be liable for any damages you suffer as a result of using. 2. The sample program is provided to you on an "AS IS" basis.

without warranty of any kind. Create another annotated managed bean and specify the name as PortfolioList. See the PortfolioList. Portfolio. 5. Add the following variables in PortfolioList. EITHER EXPRESS OR IMPLIED. add the following methods. as shown in Code snippet 17: Code Snippet 17 <h:panelGrid styleClass="panelGrid" id="grid1" columns="2"></h:panelGrid> 2. as shown in Code snippet 18: Code Snippet 18 <h:outputLabel styleClass="outputLabel" value="Select View: " id="label1" The sample program is provided to you on an "AS IS" basis. getStatus() methods in the managed bean class that is.xml file and drag a Panel-Grid item from the Standard Faces Components drawer onto the facelet (PortfolioView. so the above limitations or exclusions may not apply to you.xhtml). See Portfolio. getFontColor(). Add updateValue(). Some jurisdictions do not allow for the exclusion or limitation of implied warranties. as shown in Figure 9.xhtml). Add annotations to the class. Custom code specific to the application To customize the portlets and add portfolio specifics service to the Stock application. ArrayList<Portfolio> filteredStocks. 1. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. static final String PORTFOLIO_FILE = "/portfolio. 2. . checkPortfolioData() methods which are needed to read the data from the XML file. font color based on profit and loss in the “Profit/Loss” column. Open the PortfolioView. Add getStatusImage(). 2. as shown in Code Snippet 16: Code Snippet 16 private private private private ArrayList<Portfolio> stocks. Name the managed bean as portfolioList. modifying or distributing the sample program or its derivatives. Add parseXML(). Develop GUI using RichFaces widgets 1.java. String selectedView. as shown in Code Snippet 1.java. which is needed to get the color of the arrow showing the trends. 3. Specify the value as Select View: Following tag would be added in facelet.4. getMarketValue(). 4. Drag Label from the Standard Faces Components drawer inside panel grid onto the facelet (PortfolioView. Custom code specific to the application To customize the portlets and add trading specific status services to the Stock application. INCLUDING. 5. Right-click in the file and select Source->Generate Getters and Setters.java (in the attached sample) for the details of these methods. BUT NOT LIMITED TO. 3.java (in the attached sample) for the details about the added methods. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. add the following methods. to generate the getters and setters. Right-click in the file and select Source->Generate Constructor using Fields to generate the constructor with fields for managed bean. getFilteredStocks() methods which are needed to filter the stock data.xml". IBM shall not be liable for any damages you suffer as a result of using. 1. as shown in Figure 10.

. without warranty of any kind. This is needed to view the filtered data of stocks based on profit and loss. Buy Price.exchangename}"></h:outputText> </rich:column> </rich:dataTable> 7.xhtml). BUT NOT LIMITED TO. font-size: small"></h:outputLabel> 4. Drag column item from the rich drawer onto the facelet (PortfolioView. To select the value right click on select and select Properties and set the value as #{portfolioList.Name. as shown in Code Snippet 21: Code Snippet 21 <rich:column id="column2"> <f:facet name="header"> <h:outputText value="Name" styleClass="outputText" style="font-size: small.stockname}"></h:outputText> </rich:column> <rich:column id="column3"> The sample program is provided to you on an "AS IS" basis. Drag dataTable item from the rich drawer onto the facelet (PortfolioView. as shown in Code Snippet 20: Code Snippet 20 <rich:dataTable var="stock" value="#{portfolioList.xhtml) and add the columns. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. INCLUDING. 5. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. as shown in Code Snippet 19: Code Snippet 19 <rich:select styleClass="selectOneMenu" id="menu1" value="#{portfolioList.margin-left:3px" noDataLabel="No records found.for="menu1" style="font-weight: bold. Current Price.selectedView}" defaultLabel="All" valueChangeListener="#{portfolioList.selectedView}. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.xhtml) file to add columns . IBM shall not be liable for any damages you suffer as a result of using. so the above limitations or exclusions may not apply to you. Quantity. Set the choices and the Value. Drag select from rich drawer inside panel grid onto the facelet (PortfolioView. float: left"></h:outputText> </f:facet> <h:outputText styleClass="outputText" value="#{stock."> <rich:column id="column1"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Exchange" style="font-size: small. Market Value and Pofit/Loss and set their values from Properties view by right click on each column. EITHER EXPRESS OR IMPLIED.filteredStocks}" id="table1" style="width: 600px.updateValue}"> <f:selectItem itemLabel="All" itemValue="All" id="selectItem1" /> <f:selectItem itemLabel="Profit" itemValue="Profit" id="selectItem2" /> <f:selectItem itemLabel="Loss" itemValue="Loss" id="selectItem3" /> <a4j:ajax execute="@form" render="table1" event="selectitem"></a4j:ajax> </rich:select> 6. float: left"></h:outputText> </f:facet> <h:outputText styleClass="outputText" value="#{stock.

quantity}"></h:outputText> </rich:column> <rich:column id="column6"> <f:facet name="header"> <h:outputText value="Market Value" styleClass="outputText" style="font-size: small. float: right"></h:outputText> </f:facet> <h:outputText styleClass="outputText" style="float: right" value="#{stock. BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you. float: right"></h:outputText> </f:facet> <h:outputText styleClass="outputText" style="float: right" value="#{stock. . Add two more columns to the data table with command links to buy and sell the stocks and set their values from Properties view by right click on each column. float: right"></h:outputText> </f:facet> <h:graphicImage styleClass="graphicImage" id="image1" name="#{stock. without warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. modifying or distributing the sample program or its derivatives.color: #{stock.statusImage}" library="img" style="float: right"></h:graphicImage> <h:outputText styleClass="outputText" style="float: right.buyPrice}"></h:outputText> </rich:column> <rich:column id="column4"> <f:facet name="header"> <h:outputText value="Current Price" styleClass="outputText" style="font-size: small. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.fontColor}" value="#{stock.currentPrice}"></h:outputText> </rich:column> <rich:column id="column5"> <f:facet name="header"> <h:outputText value="Quantity" styleClass="outputText" style="font-size: small. EITHER EXPRESS OR IMPLIED. as shown in Code Snippet 22: Code Snippet 22 <rich:column id="column8"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: right"></h:outputText> The sample program is provided to you on an "AS IS" basis.<f:facet name="header"> <h:outputText value="Buy Price" styleClass="outputText" style="font-size: small. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. INCLUDING.marketValue}"></h:outputText> </rich:column> <rich:column id="column7"> <f:facet name="header"> <h:outputText value="Profit/Loss" styleClass="outputText" style="font-size: small. float: right"></h:outputText> </f:facet> <h:outputText styleClass="outputText" style="float: right" value="#{stock. float: right"></h:outputText> </f:facet> <h:outputText styleClass="outputText" style="float: right" value="#{stock.status}"></h:outputText> </rich:column> 8.

without warranty of any kind. so the above limitations or exclusions may not apply to you. IBM shall not be liable for any damages you suffer as a result of using.</f:facet> <h:commandLink value="Buy" styleClass="commandLink" id="link1" action="#{tradingService.stockname}"></f:param> <f:param name="portletname" value="portfolio"></f:param> </h:commandLink> </rich:column> <rich:column id="column9"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: left"></h:outputText> </f:facet> <h:commandLink type="submit" value=" Sell" styleClass="commandLink" id="link2" action="#{tradingService. . IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. BUT NOT LIMITED TO. You can buy or sell these stocks.exchangename}"></f:param> <f:param name="stockname" value="#{stock. INCLUDING.stockname}"></f:param> <f:param name="portletname" value="portfolio"></f:param> </h:commandLink> </rich:column> Develop Watchlist portlet The Watchlist portlet displays a list of stocks that are on the watch list of a trading account. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. or remove them from the watch list.exchangename}"></f:param> <f:param name="stockname" value="#{stock. Figure: WatchList Portlet AltText: Watchlist Portlet as seen on browser The sample program is provided to you on an "AS IS" basis.sellPage}" style="float: left"> <f:param name="exchangename" value="#{stock. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. EITHER EXPRESS OR IMPLIED.buyPage}" style="float: right"> <f:param name="exchangename" value="#{stock.

1.gif".xml". as shown in Code Snippet 24: Code Snippet 24 private private private private private private ArrayList<Watch> stocks. See Watch. EITHER EXPRESS OR IMPLIED. as shown in Code Snippet 1. add the following methods. 3. as shown in Code Snippet 1. String stockname. private private private private static static static static 4. sortByStockName(). 3.Create scoped managed bean 1. modifying or distributing the sample program or its derivatives. final final final final String String String String RED_COLOUR = "#FF0000". static Boolean ascendingStock. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. INCLUDING. and name the managed bean as watchList. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.java.java (in the attached sample) for the details about the added methods. Custom code specific to the application To customize the portlets and add watch list specific display to the Stock application.gif". font color based on profit and loss in the “last price” column. getPercentChangeFontColor() methods in the managed bean class that is Watch. float lastPrice. Add sortByExchangeName(). The sample program is provided to you on an "AS IS" basis.java (in the attached sample) for the details of this method. sortByPercentChange() methods in WatchList. add the following methods: 1. Add getImage(). static Boolean ascendingPercentChange. Right-click in the file and select Source->Generate Getters and Setters to generate the getters and setters for added class. and name the managed bean as watch. 5. DOWN_ARROW = "arrow_down_red. . Right-click in the file and select Source->Generate Constructor using Fields to generate the constructor with fields for managed bean. String percentChange. Create a Java class as shown in Figure 8. BUT NOT LIMITED TO. 4.java to sort the columns of the dataTable. 2. as shown in Figure 9. boolean deleteAction = false. and name it as Watch. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Add the class variables and constants for the managed bean. See the WatchList. static final String WATCHLIST_FILE = "/watchlist. which is needed to get the color of the arrow showing the trends. UP_ARROW = "arrow_up_green. Add annotations to the class. IBM shall not be liable for any damages you suffer as a result of using. Custom code specific to the application To customize the portlets and add watch list specific display to the Stock application. so the above limitations or exclusions may not apply to you.java. without warranty of any kind. static Boolean ascendingExchange. GREEN_COLOUR = "#006400". Add the following variables in WatchList. Add annotations to the class. as shown in Code Snippet 23: Code Snippet 23 private private private private String exchangename. 2. as shown in Figure 10. Similarly create another annotated managed bean and specify the name as WatchList.

float: right"></h:outputText> </f:facet> <h:graphicImage styleClass="graphicImage" id="image1" name="#{stock.lastPrice}" style="float: right.stockname}"></h:outputText> </rich:column> <rich:column id="column3"> <f:facet name="header"> <h:outputText value="Last Price" styleClass="outputText" style="font-size: small."> <rich:column id="column1"> <f:facet name="header"> <a4j:commandLink styleClass="commandLink" id="link4" render="table1" value="Exchange" style="font-size: small. as shown in Code Snippet 25: Code Snippet 25 <rich:dataTable var="stock" value="#{watchList. as shown in Code Snippet 26: Code Snippet 26 <rich:column id="column2"> <f:facet name="header"> <a4j:commandLink styleClass="commandLink" id="link5" value="Name" style="font-size: small.xhtml) file to add columns .sortByExchangeName}"> </a4j:commandLink> </f:facet> <h:outputText value="#{stock.color:#{stock. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Open WatchlistView. INCLUDING. float: left" action="#{watchList. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. EITHER EXPRESS OR IMPLIED. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Develop GUI using RichFaces widgets 1. 2. BUT NOT LIMITED TO.xhtml).2. float: left" render="table1" action="#{watchList. IBM shall not be liable for any damages you suffer as a result of using. 3.image}" library="img" style="float: right"></h:graphicImage> <h:outputText value="#{stock. Add parseXML() method to read the sample data from the XML file.exchangename}"></h:outputText> </rich:column> </rich:dataTable> 3.percentChangeFontColor}"></h:outputText> </rich:column> The sample program is provided to you on an "AS IS" basis. Last Price and % Change and set their values from Properties view by right click on each column.Name.sortByStockName}"> </a4j:commandLink> </f:facet> <h:outputText value="#{stock. Add the columns and set their values from Properties view by right click on each column.stocks}" id="table1" style="width: 400px" noDataLabel="No records found. without warranty of any kind. Drag column item from the rich drawer of the Palette view onto the facelet (WatchlistView. Add deleteStock() method to remove the selected stock from the watchlist portlet.xhtml and drag dataTable from the rich drawer in the facelet (WatchlistView. .

sortByPercentChange}"> </a4j:commandLink> </f:facet> <h:outputText value="#{stock. INCLUDING.exchangename}" The sample program is provided to you on an "AS IS" basis. 5. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<rich:column id="column4"> <f:facet name="header"> <a4j:commandLink styleClass="commandLink" id="link7" render="table1" value="% Change" style="font-size: small.percentChangeFontColor}"></h:outputText> </rich:column> 4. modifying or distributing the sample program or its derivatives. BUT NOT LIMITED TO.percentChange}%" style="float: right. EITHER EXPRESS OR IMPLIED. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. so the above limitations or exclusions may not apply to you.exchangename}"></f:param> <f:param name="stockname" value="#{stock. Set the column values from Properties view by right click on each column.stockname}"></f:param> <f:param name="portletname" value="watchlist"></f:param> </h:commandLink> </rich:column> <rich:column id="column6"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: right"></h:outputText> </f:facet> <h:commandLink value="Sell" styleClass="commandLink" id="link2" action="#{tradingService.exchangename}"></f:param> <f:param name="stockname" value="#{stock. without warranty of any kind. float: right" action="#{watchList. sell and unwatch the stocks. as shown in Code Snippet 27: Code Snippet 27 <rich:column id="column5"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: right"></h:outputText> </f:facet> <h:commandLink value="Buy" styleClass="commandLink" id="link1" action="#{tradingService. Add three more columns to the data table with command links which enable the user to buy.deleteStock}"> <a4j:param name="exchangename" value="#{stock.buyPage}" style="float: right"> <f:param name="exchangename" value="#{stock. .color:#{stock.stockname}"></f:param> <f:param name="portletname" value="watchlist"></f:param> </h:commandLink> </rich:column> <rich:column id="column7"> <f:facet name="header"> <h:outputText value="" styleClass="outputText" style="float: left"></h:outputText> </f:facet> <a4j:commandLink value="Unwatch" styleClass="commandLink" render="table1" style="float: left" action="#{watchList. IBM shall not be liable for any damages you suffer as a result of using.sellPage}" style="float: left"> <f:param name="exchangename" value="#{stock.

without warranty of any kind.stockname}"></a4j:param> </a4j:commandLink> </rich:column> Similarly.xhtml BuyConfirm.xhtml Sell. modifying or distributing the sample program or its derivatives.xhtml SellError. INCLUDING.assignTo="#{stock.exchangename}"></a4j:param> <a4j:param name="stockname" value="#{stock. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. • • • • • • • Buy. BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED.xhtml BuySuccess. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. See sample code for details of these pages. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. create the following portlet facelets for buying and selling stocks. . as shown in Figure 12.xhtml SellConfirm.xhtml SellSuccess.stockname}" assignTo="#{stock.xhtml The sample program is provided to you on an "AS IS" basis.

. Click OK. BUT NOT LIMITED TO. • Second Page – Name the titleof the page as My Trading and “Friendly URL name as trading.0 and click Finish. Create four pages as: • First Page – Name the title of the page as Markets Overview and Friendly URL name as marketwatch. 7. Right-click on portlet project and select Deploy Portlet. Click the New Label and enter the “title” as Bank Home and Friendly URL name as bankhome. • Fourth Page – Name the title of the page as Watchlist and Friendly URL name as watchlist. as shown in Figure 24: Figure 24: Deploy Portlet Wizard AltText: The first page of the deploy portlet wizard 2. 4. 3. IBM shall not be liable for any damages you suffer as a result of using. without warranty of any kind. Select Investments and click New Page. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Click the Bank Home label and create a new label title as Investments and Friendly URL name as investments.Deploy Portlet wizard displays. 6. 5.Deploy application on WebSphere Portal server To deploy the Stock sample application: 1. INCLUDING. Select Manage Pages and click on Content Root. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.. Right-click on server instance in the Server view and select Open Portal. The sample program is provided to you on an "AS IS" basis. so the above limitations or exclusions may not apply to you. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. • Third Page – Name the title of the page as Portfolio and Friendly URL name as portfolio. Click OK. Click Administration. Select WebSphere Portal Server v8.

so the above limitations or exclusions may not apply to you. Portfolio and Watchlist pages also. select the Watchlist portlet. 9. . click Save. without warranty of any kind. Figure 25: Edit Page Layout AltText: Select Edit Page Layout icon and add portlet to portal page • For the second page. and then go back to View Mode. The sample program is provided to you on an "AS IS" basis. 10. Repeat the steps for My Trading. select the Trading portlet. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.8. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. select 1 column. BUT NOT LIMITED TO. Select Edit Page Layout as shown in Figure 25 to add the following portlets deployed in step 3 to the corresponding pages: • For the first page. modifying or distributing the sample program or its derivatives. Select Layout tab. • For the fourth page. IBM shall not be liable for any damages you suffer as a result of using. • For the third page. select the Portfolio portlet. EITHER EXPRESS OR IMPLIED. select the Market Watch portlet. Click Bank Home from the Menu bar and click Edit Mode. INCLUDING. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.

EITHER EXPRESS OR IMPLIED. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. . INCLUDING. so the above limitations or exclusions may not apply to you. For example.0 The sample program is provided to you on an "AS IS" basis. modifying or distributing the sample program or its derivatives. BUT NOT LIMITED TO. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To see the graphs for different exchanges.: click JASSIN as shown in Figure 26: Figure 26: Market Watch Portlet AltText: MarketWatch deployed on WebSphere Portal Server v8. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. IBM shall not be liable for any damages you suffer as a result of using. click on any Exchange link. without warranty of any kind.Execute the application on the server Market Watch Portlet Markets Overview page contains the Market Watch portlet to view the latest market trends.

Trading Portlet To do the trading: 1. BUT NOT LIMITED TO. and the red color depicts that it lost points. 2.NOTE: In this sample application the GREEN (upward arrow) color is used to show the upward trend of a stock and the RED (downward arrow) color is used to show the downward trend on any trading day. A data table displays the information about that stock as shown in Figure 27: Figure 27: Trading Portlet AltText: Trading Portlet deployed on WebSphere Portal Server v8. so the above limitations or exclusions may not apply to you. EITHER EXPRESS OR IMPLIED. INCLUDING. Enter stock name and click Get Quotes. The green color depicts that the stock gained points from its last trading day. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.0 The sample program is provided to you on an "AS IS" basis. Select any Exchange from the select box. without warranty of any kind. . IBM shall not be liable for any damages you suffer as a result of using. modifying or distributing the sample program or its derivatives.

without warranty of any kind. IBM shall not be liable for any damages you suffer as a result of using.0 The sample program is provided to you on an "AS IS" basis. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.Figure 28: Trading Portlet View AltText: Trading Portlet deployed on WebSphere Portal Server v8. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. modifying or distributing the sample program or its derivatives. so the above limitations or exclusions may not apply to you. INCLUDING. BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED. .

without warranty of any kind.On top of the portlet. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. BUT NOT LIMITED TO. a message is displayed "Go to Help mode for the sample input value. . so the above limitations or exclusions may not apply to you. INCLUDING." Go to Help mode to check all the stocks that are available in database as shown in Figure 29: Figure 29: Help mode of Trading Portlet AltText: Help page for Trading Portlet The sample program is provided to you on an "AS IS" basis. modifying or distributing the sample program or its derivatives. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. IBM shall not be liable for any damages you suffer as a result of using. EITHER EXPRESS OR IMPLIED. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

INCLUDING. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. EITHER EXPRESS OR IMPLIED. any stock that you sells from the portfolio.0 The sample program is provided to you on an "AS IS" basis. Any stock that you buy. so the above limitations or exclusions may not apply to you. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. modifying or distributing the sample program or its derivatives. without warranty of any kind. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Similarly. IBM shall not be liable for any damages you suffer as a result of using. it automatically show up in the portfolio.Portfolio Portlet The Portfolio portlet displays a data table to show the existing stocks in a portfolio. BUT NOT LIMITED TO. is removed as shown in Figure 30: Figure 30: Portfolio Portlet AltText: Portfolio portlet deployed on WebSphere Portal Server v8. .

Watchlist Portlet The Watchlist portlet displays a data table of stocks that are monitored regularly. and remove stocks from the watch list. You can buy. so the above limitations or exclusions may not apply to you. modifying or distributing the sample program or its derivatives.0 Buy and Sell Operations Buy and Sell operations are performed from the following three portlets: • • • Trading Portlet Portfolio Portlet Watchlist Portlet Buy and Sell operation procedure is same from all the three portlets. it is automatically added to the watch list. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. IBM shall not be liable for any damages you suffer as a result of using. Any stock that you select from the trading portlet by clicking Watch link. BUT NOT LIMITED TO. EITHER EXPRESS OR IMPLIED. sell. The sample program is provided to you on an "AS IS" basis. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. INCLUDING. . without warranty of any kind. as shown in Figure 31: Figure 31: WatchList Portlet AltText: Watchlist Portlet deployed on WebSphere Portal Server v8.

. Click Buy link next to the stock you want to buy. and click Get Quotes. Select an Exchange and enter the stock name. EITHER EXPRESS OR IMPLIED. as shown in Figure 32: Figure 32: Buy operation in Trading portlet AltText: Buying a stock from Trading portlet The sample program is provided to you on an "AS IS" basis. INCLUDING. without warranty of any kind. modifying or distributing the sample program or its derivatives. 2. BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES.Buy Operation from Trading Portlet To buy stocks: 1. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. A data table displays information about the stock. IBM shall not be liable for any damages you suffer as a result of using.

. A page opens with Exchange name and Stock name. as shown in Figure 33: Figure 33: Buy stocks page in Trading portlet AltText: Page to enter details for buying stock The sample program is provided to you on an "AS IS" basis. 4.3. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. EITHER EXPRESS OR IMPLIED. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. modifying or distributing the sample program or its derivatives. BUT NOT LIMITED TO. Enter the price and quantity and click Submit. IBM shall not be liable for any damages you suffer as a result of using. INCLUDING. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. without warranty of any kind.

. BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you.5. IBM shall not be liable for any damages you suffer as a result of using. INCLUDING. without warranty of any kind. modifying or distributing the sample program or its derivatives. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. A confirmation page displays the details of the transactions. 6. Click Confirm to execute the buy operation as shown in Figure 34: Figure 34: Confirmation page AltText: Page confirming the details for buying stock The sample program is provided to you on an "AS IS" basis. EITHER EXPRESS OR IMPLIED. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.

. without warranty of any kind. BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. as shown in Figure 35: Figure 35: Success Page AltText: Confirmation page showing success The sample program is provided to you on an "AS IS" basis. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. A page with a message. EITHER EXPRESS OR IMPLIED. “15 shares of MASSAU successfully bought at 2400 price” displays. modifying or distributing the sample program or its derivatives. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. INCLUDING. for example.7.

2. . EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. without warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. BUT NOT LIMITED TO. so the above limitations or exclusions may not apply to you. A data table displays information the stock. Select an Exchange enter the stock name. Click Get Quotes. INCLUDING. IBM shall not be liable for any damages you suffer as a result of using. 3. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Click Sell link next to the stock you want to sell as shown in Figure 36: Figure 36: Sell operation in Trading portlet AltText: Sell operation in Trading portlet The sample program is provided to you on an "AS IS" basis. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.Sell Operation from Trading Portlet To sell stocks: 1.

IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. IBM shall not be liable for any damages you suffer as a result of using. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. without warranty of any kind. A page opens with Exchange name and Stock name. so the above limitations or exclusions may not apply to you. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. .4. BUT NOT LIMITED TO. 5. INCLUDING. EITHER EXPRESS OR IMPLIED. Enter the price and quantity and click Submit. modifying or distributing the sample program or its derivatives. as shown in Figure 37: Figure 37: Stock Sell page in Trading portlet AltText: Page to sell a stock The sample program is provided to you on an "AS IS" basis.

a confirmation page displays the details of the transactions. BUT NOT LIMITED TO. Click Confirm to execute the sell operation as shown in Figure 39: Figure 39: Sell operation confirmation page in Trading portlet AltText: Confirming the sell operation details The sample program is provided to you on an "AS IS" basis. If selected stock doesn’t exist in your Portfolio. IBM shall not be liable for any damages you suffer as a result of using. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.6. so the above limitations or exclusions may not apply to you. an error page is displayed with a message “You cannot sell this stock as it does not exist in your portfolio” as shown in Figure 38: Figure 38: Sell operation in Trading portlet AltText: Selected stock not in portfolio message 7. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. If selected stock exists in your portfolio. . INCLUDING. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. without warranty of any kind. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives.

IBM shall not be liable for any damages you suffer as a result of using. BUT NOT LIMITED TO. A page with a message. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. without warranty of any kind. EITHER EXPRESS OR IMPLIED. modifying or distributing the sample program or its derivatives. “15 shares of JASSAU successfully sold at 2000 price.” displays. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. .8. INCLUDING. as shown in Figure 40: Figure 40: Sell operation in Trading portlet AltText: Success message after sell operation The sample program is provided to you on an "AS IS" basis. for example.

Watch operation from Trading portlet To watch stock operation: 1. Click Get Quotes. 2. EITHER EXPRESS OR IMPLIED. without warranty of any kind. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. A data table is displayed with information about that stock as shown in Figure 41: Figure 41: Watch operation in Trading portlet AltText: Watch option in Trading portlet The sample program is provided to you on an "AS IS" basis. modifying or distributing the sample program or its derivatives. INCLUDING. . IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM shall not be liable for any damages you suffer as a result of using. Select any Exchange and enter the stock name. BUT NOT LIMITED TO.

without warranty of any kind. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. Click Watch to add the selected stock to the Watchlist portlet as shown in Figure 42: Figure 42: Watch operation in Trading portlet AltText: Watchlist deployed on WebSphere Portal Server v8. EITHER EXPRESS OR IMPLIED. INCLUDING. so the above limitations or exclusions may not apply to you. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.0 The sample program is provided to you on an "AS IS" basis. . modifying or distributing the sample program or its derivatives.3. IBM shall not be liable for any damages you suffer as a result of using. BUT NOT LIMITED TO.

0 2.Remove transactions from Watchlist portlet To remove a stock from the Watchlist portlet: 1. INCLUDING. BUT NOT LIMITED TO. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. modifying or distributing the sample program or its derivatives. Some jurisdictions do not allow for the exclusion or limitation of implied warranties. so the above limitations or exclusions may not apply to you. EITHER EXPRESS OR IMPLIED. as shown in Figure 43: Figure 43: Remove transaction in Trading portlet AltText: Watchlist deployed on WebSphere Portal Server v8. without warranty of any kind. . THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. click on Unwatch. IBM shall not be liable for any damages you suffer as a result of using. The stock is removed from the Watchlist portlet as shown in Figure 44: Figure 44: WatchList portlet AltText: Unwatch operation for the stocks The sample program is provided to you on an "AS IS" basis.

BUT NOT LIMITED TO. Some jurisdictions do not allow for the exclusion or limitation of implied warranties.ibm.0 ◦ • ◦ • http://www-01.wss?uid=swg24032855. EITHER EXPRESS OR IMPLIED. INCLUDING. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.5 makes it easy to configure and leverage a third party library like RichFaces. This library adds more richness and functionality to basic JSF widgets. RichFaces – JSF component suite.wss?uid=swg27007791 Rational Application Developer for WebSphere Software 8. .jboss. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES. References • IBM Webphere Portal Server 8.org/richfaces The sample program is provided to you on an "AS IS" basis. ◦ http://www. without warranty of any kind. but also learnt how Rational Application Developer v8. modifying or distributing the sample program or its derivatives.com/support/docview.com/support/docview. JSF portal applications are significant as they bring together best of both worlds. so the above limitations or exclusions may not apply to you. IBM shall not be liable for any damages you suffer as a result of using.5 http://www-01.Conclusion In this article you not only saw the power of JSF and portlets working together.ibm.