wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Problem with a portlet" Watch "Problem with a portlet" New topic
Author

Problem with a portlet

Gorka Astigarraga
Greenhorn

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

public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException
{
try
{
System.out.println("showText doView()...");
response.setContentType("text/html");
Writer writer = response.getWriter();
PortletPreferences prefs = request.getPreferences();
String text = prefs.getValue("text", null);
if(text == null)
text = "no text";
writer.write(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
Greenhorn

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
 
Similar Threads
JButton, JTextField, ActionListener
Problem with Portlet Preferences not loading
getHeader() in do view
Accessing Portlet Title in JSF
Can I invoke portlet doview() in JSF pagecode?