This sample model shows how one can verify profile based inputs entered at runtime.
This sample provides a simple example of how to do custom logic on profiled inputs entered at runtime. This is useful when one needs to verify the user has entered an acceptable value in the personalize section of the portlet. In this sample I am doing verification on a profiled variable builder. If your scenario is more advanced, then you can simply reference a profiled variable builder from the field in whatever build you wish to use. In this example I first take the profiled variable and pass it to a method.
Here you can do custom logic to verify the user has entered in a proper value. In this case, I want to make sure the user has entered a name less than 10 characters. I then return a Boolean value (true or false) and use a basic if else statement to determine what page is displayed. Upon entering an invalid value it would be best to display a fail page explaining to the user what must be done to resolve the problem. Finally, the section in the portlet adapter builder labeled Profile Sets needs to be changed to Show individual profile values in Edit and Edit Defaults so these values are exposed to the user at runtime.
Notes on running the sample and prerequisites
Import the attached zip file into your project using the Import WebSphere Portlet Factory Archive command.