Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category Web Experience Factory 8 Documentation WebSphere Portlet Factory 7 Documentation WebSphere Portlet Factory 7.0.1 Documentation Custom Search Scope...
Search
Community Articles > Samples and techniques > How to personalize an xml variable
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Francis H Lieu
Contribution Summary:
  • Articles authored: 2
  • Articles edited: 1
  • Comments Posted: 0

Recent articles by this author

How to handle the errors from the File Upload builder

This model illustrates how one can catch errors from the File Upload builder.


For example, the user may exceed the allowed file size.
If so the portlet needs to be smart enough to show the proper error page instead of displaying a confusing stack trace.
This is the code ...

How to personalize an xml variable

h3 This sample shows how to profile enable an xml variable and personalize it in the portlet "edit" customizer. h3 This is useful when the xml is a complex piece of data which needs to be modified on a per user basis. In our sample the profile xml is the data for a select drop down builder. ...

Community articleHow to personalize an xml variable

Added by Francis H Lieu | Edited by Keshi Dai on July 29, 2010 | Version 8
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: Profiling

This sample shows how to profile enable an xml variable and personalize it in the portlet "edit" customizer.



This is useful when the xml is a complex piece of data which needs to be modified on a per user basis.
In our sample the profile xml is the data for a select drop down builder. This xml stores the name of cities and its zip as name value pairs.



"< location origin="provided" >< label > WTC< /label >< code > 97204< /code >< /location >"   



The portlet only has one UI which is the select drop down

 Select Drop Down



The customizer is basically a "list" builder which lets you choose between several cities so that when you click on Save Data and and OK the select drop down box will be updated with the new list of cities. This UI is very convenient as it lets you do "Remove all" and "Add all" if the user is interested in doing so.



 Customizer



The Save method in the customizer sets the value of the profiled xml so that it is passed back to the portlet.


Since the List builder only returns a list of cities "City1", "Oregon City Line" that is not sufficient as the zip code is also needed.


Thus the save method uses the Websphere Portlet Factory's IXml API to build an xml with the proper name value pairs (as shown above).



Once the user adds a new city to the list as shown below and clicks "Save Data" and "OK" ...



 Add a new city and save data



This is how the portlet looks like as expected

 Expected Portlet


expanded Attachments (5)
collapsed Attachments (5)
File TypeSizeFile NameCreated On
application/x-zip 5 KB XmlPersonalizeSample.zip 7/29/10 4:13 PM
image/jpeg 4 KB pic1.jpg 7/29/10 4:13 PM
image/jpeg 13 KB pic2.jpg 7/29/10 4:13 PM
image/jpeg 14 KB pic3.jpg 7/29/10 4:13 PM
image/jpeg 4 KB pic4.jpg 7/29/10 4:13 PM
expanded Versions (9)
collapsed Versions (9)
Version Comparison     
VersionDateChanged by              Summary of changes
9Jul 29, 2010 4:13:42 PMKeshi Dai  
This version (8)Jul 29, 2010 4:13:18 PMKeshi Dai  
7Jul 29, 2010 4:08:15 PMKeshi Dai  
6Jan 15, 2010 5:13:55 PMRob Flynn  IBM contributor
5Dec 28, 2009 2:10:41 PMRob Flynn  IBM contributor
4Jan 9, 2009 12:14:31 PMFrancis H Lieu  IBM contributor
3Jan 9, 2009 12:03:36 PMFrancis H Lieu  IBM contributor
2Jan 9, 2009 11:52:20 AMFrancis H Lieu  IBM contributor
1Jan 9, 2009 11:39:56 AMFrancis H Lieu  IBM contributor
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • BlogsIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use