IntelliJ Java IDE
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
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Reply 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: 4962

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


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
IntelliJ Java IDE
 
subject: how to use portlet preferences in jboss
 
Threads others viewed
Portal Deployed;but cant see it.
Problem with Portlet Preferences not loading
Problem saving a PDF document
it's blocking me!my first portlet doesn't work!
how to use portlet preferences in jboss
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture