This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use portlet preferences in jboss

 
kuttima vs
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic