[pal-cvs 3443] [1177] set portlet title.

svnno****@sourc***** svnno****@sourc*****
2008年 9月 24日 (水) 18:25:46 JST


Revision: 1177
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=1177
Author:   shinsuke
Date:     2008-09-24 18:25:45 +0900 (Wed, 24 Sep 2008)

Log Message:
-----------
set portlet title.

Modified Paths:
--------------
    googlegadgets/trunk/src/main/java/jp/sf/pal/ggadget/action/ViewAction.java


-------------- next part --------------
Modified: googlegadgets/trunk/src/main/java/jp/sf/pal/ggadget/action/ViewAction.java
===================================================================
--- googlegadgets/trunk/src/main/java/jp/sf/pal/ggadget/action/ViewAction.java	2008-09-24 09:04:48 UTC (rev 1176)
+++ googlegadgets/trunk/src/main/java/jp/sf/pal/ggadget/action/ViewAction.java	2008-09-24 09:25:45 UTC (rev 1177)
@@ -2,6 +2,7 @@
 
 import java.io.Serializable;
 
+import javax.portlet.RenderResponse;
 import javax.servlet.http.HttpServletRequest;
 
 import jp.sf.pal.ggadget.GGadgetConstants;
@@ -9,6 +10,7 @@
 
 import org.seasar.struts.annotation.Execute;
 import org.seasar.struts.exception.ActionMessagesException;
+import org.seasar.struts.portlet.util.PortletUtil;
 
 public class ViewAction implements Serializable {
 
@@ -29,9 +31,23 @@
             return "error.jsp";
         }
         url = value;
+
+        setPortletTitle();
+
         return "index.jsp";
     }
 
+    private void setPortletTitle() {
+        RenderResponse renderResponse = PortletUtil.getRenderResponse(request);
+        if (renderResponse != null) {
+            String value = GGadgetUtil.getPreferenceValue(request,
+                    GGadgetConstants.NAME, "");
+            if (!"".equals(value)) {
+                renderResponse.setTitle(value);
+            }
+        }
+    }
+
     public HttpServletRequest getRequest() {
         return request;
     }


pal-cvs メーリングリストの案内