on 2006 Feb 24 9:58 AM
Hey people!
Im using the method getProperties() in my AbstractPortalComponent. This method returns an enumeration of the properties name. When im iterating true the Enumeration, i get so much extra values out from the loop.
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
IPortalComponentContext context = request.getComponentContext();
IPortalComponentProfile profile = context.getProfile();
Enumeration e = (Enumeration) profile.getProperties();
while(e.hasMoreElements()) {
String name = profile.getProperty(e.nextElement()
.toString());
response.write(name);
}
}
Am I missing a casting or something? When im running it in the portal in a view, i get the whole pcd url, information about the broswer, pixels, the time and so on.
Hi Kristoffer,
To "filter" your own custom properties I would suggest you to use some prefixes in property names, like "MY_OWN_PROPERTY_1".
Than it can looks like:
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
IPortalComponentContext context = request.getComponentContext();
IPortalComponentProfile profile = context.getProfile();
Enumeration e = profile.getProperties();
while(e.hasMoreElements()) {
String nameOfProperty = e.nextElement().toString();
if(nameOfProperty.startsWith("MY_OWN_PROPERTY")) {
String name = profile.getProperty( nameOfProperty );
response.write(name);
}
}
}
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can try this to get property name and value...
IPortalComponentContext context = request.getComponentContext();
IPortalComponentProfile profile = context.getProfile();
Enumeration e = (Enumeration) profile.getProperties();
while(e.hasMoreElements()) {
IProperty ip = (IProperty)e.nextElement();
String name = ip.getName();
String value = ip.getValue();
response.write("Name:"name"Value:"+value);
}
Hope this helps.
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.