This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes how to use portlet preferences in jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "how to use portlet preferences in jboss" Watch "how to use portlet preferences in jboss" New topic
Author

how to use portlet preferences in jboss

kuttima vs
Greenhorn

Joined: Feb 25, 2007
Posts: 2
Hi friends !
I want my dynamic data to be displayed in my portlet which i will give it thro' my preferences..
Im able to access my preferences.. But my problem is im getting my default value only.. Not my dynamic value..

Its all to worked in jboss... And i had attached some samples of code..

My java file...


protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
{
PortletPreferences pref = rRequest.getPreferences();
System.out.println("Hello______Portlet: oView:Entered");
rResponse.setContentType("text/html");
PrintWriter writer = rResponse.getWriter();
writer.write("doView :: "+ pref.getValue("color","0"));
writer.close();
System.out.println("Hello______Portlet: oView:Exiting");
}



My Porlet.xml....

<portlet-app>
<portlet>
<portlet-name>HelloWorldPortlet</portlet-name>
<portlet-class>org.jboss.portlet.hello.HelloWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>EDIT</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
<portlet-info>
<title>HelloWorld</title>
</portlet-info>
<portlet-preferences>
<preference>
<name>color</name>
<value>Default color ! - From portlet.xml</value>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>

My portlet-instances.xml.....

<deployments>
<deployment>
<instance>
<instance-id>HelloWorldPortletInstance1</instance-id>
<portlet-ref>HelloWorldPortlet</portlet-ref>
<preferences>
<preference>
<name>color</name>
<value>Blue - From instances.xml</value>
</preference>
</preferences>
</instance>
</deployment>

<deployment>
<instance>
<instance-id>HelloWorldPortletInstance2</instance-id>
<portlet-ref>HelloWorldPortlet</portlet-ref>
<preferences>
<preference>
<name>color</name>
<value>Green - From instances.xml</value>
</preference>
</preferences>
</instance>
</deployment>
</deployments>


My myapp-object.xml....

<deployments>

<deployment>
<if-exists>overwrite</if-exists>
<parent-ref>default.default</parent-ref>
<window>
<window-name>Hello1</window-name>
<instance-ref>HelloWorldPortletInstance1</instance-ref>
<region>center</region>
<height>1</height>
</window>
</deployment>

<deployment>
<if-exists>overwrite</if-exists>
<parent-ref>default.default</parent-ref>
<window>
<window-name>Hello2</window-name>
<instance-ref>HelloWorldPortletInstance2</instance-ref>
<region>bottom</region>
<height>4</height>
</window>
</deployment>
</deployments>


Please help me out...
Thanks in advance...
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Which portal are you deploying to?

Correct me if I'm wrong, but isn't the portlet-instances.xml file unique to JBoss?

-Cameron McKenzie
 
jQuery in Action, 2nd edition
 
subject: how to use portlet preferences in jboss
 
Similar Threads
Problem saving a PDF document
it's blocking me!my first portlet doesn't work!
how to use portlet preferences in jboss
Portal Deployed;but cant see it.
Problem with Portlet Preferences not loading