File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use portlet preferences in jboss
 
Similar Threads
how to use portlet preferences in jboss
it's blocking me!my first portlet doesn't work!
Problem with Portlet Preferences not loading
Problem saving a PDF document
Portal Deployed;but cant see it.