File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Portals and Portlets and the fly likes Problem with a portlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Problem with a portlet" Watch "Problem with a portlet" New topic

Problem with a portlet

Gorka Astigarraga

Joined: Feb 24, 2009
Posts: 3
I have this portlet code:

public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException
System.out.println("showText doView()...");
Writer writer = response.getWriter();
PortletPreferences prefs = request.getPreferences();
String text = prefs.getValue("text", null);
if(text == null)
text = "no text";
System.out.println("showText end doView()...");
catch(Exception e)
System.out.println("Error in doView process: " + e.getMessage());

how can I do to request.getPreferences() read another portlet-preferences.xml file changing the path?
Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130
Hi Gorka,

I have few questions with regards to your problem. 1. How could you set portlet preferences in a file other than portlet.xml? 2. Why would you like to get it read from other xml file?

Coming back to your problem, as far as the portlet standards (JSR-168) goes, you have to specify all portlet related configuration in portlet.xml file only, including portlet preferences.

Work Hard, Expect The Worst...<br /> <br />Bimal R. Patel<br />(SCJP 1.2, SCWCD 1.4)
Gorka Astigarraga

Joined: Feb 24, 2009
Posts: 3
Hi Biman

I'm using eXo platform to use this portlets. This portlet only reads \portal\WEB-INF\conf\portal\group\platform\users\portlet-preferences.xml file.
I want to have this file in \portal\WEB-INF\conf\portal\user\userX\portlet-preferences.xml and I don't know how.

I think changing the path would solve the problem.

Thanks for the post
It is sorta covered in the JavaRanch Style Guide.
subject: Problem with a portlet
It's not a secret anymore!