You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/11/04 22:54:32 UTC

svn commit: r330927 - in /portals/pluto/trunk/pluto-taglib: pom.xml src/main/java/org/apache/pluto/tags/ParamTag.java src/main/java/org/apache/pluto/tags/el/ src/main/java/org/apache/pluto/tags/el/ParamTag.java src/resources/tld/portlet-el.tld

Author: ddewolf
Date: Fri Nov  4 13:54:27 2005
New Revision: 330927

URL: http://svn.apache.org/viewcvs?rev=330927&view=rev
Log:
Adding Optional EL Support to tags

Added:
    portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/
    portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
    portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet-el.tld
Modified:
    portals/pluto/trunk/pluto-taglib/pom.xml
    portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java

Modified: portals/pluto/trunk/pluto-taglib/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/pom.xml?rev=330927&r1=330926&r2=330927&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-taglib/pom.xml (original)
+++ portals/pluto/trunk/pluto-taglib/pom.xml Fri Nov  4 13:54:27 2005
@@ -20,9 +20,15 @@
 	  <scope>provided</scope>
     </dependency>
 	<dependency>
-      <groupId>servletapi</groupId>
-	  <artifactId>servletapi</artifactId>
+      <groupId>javax.servlet</groupId>
+	  <artifactId>servlet-api</artifactId>
 	  <version>2.3</version>
+	  <scope>provided</scope>
+    </dependency>
+	<dependency>
+      <groupId>javax.servlet</groupId>
+	  <artifactId>jsp-api</artifactId>
+	  <version>2.0</version>
 	  <scope>provided</scope>
     </dependency>
   </dependencies>

Modified: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java?rev=330927&r1=330926&r2=330927&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java (original)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java Fri Nov  4 13:54:27 2005
@@ -41,12 +41,14 @@
      * @return <CODE>SKIP_BODY</CODE>
      */
     public int doStartTag() throws JspException {
-        BasicURLTag urlTag = (BasicURLTag) findAncestorWithClass(this,
-                                                                 BasicURLTag.class);
+        BasicURLTag urlTag = (BasicURLTag)
+                findAncestorWithClass(this, BasicURLTag.class);
+
         if (urlTag == null) {
             throw new JspException(
                 "the 'param' Tag must have actionURL or renderURL as a parent");
         }
+
         PortletURL url = urlTag.getUrl();
 
         if (getName() != null) {
@@ -68,7 +70,7 @@
      * Returns the value.
      * @return String
      */
-    public String getValue() {
+    public String getValue() throws JspException {
         if (value == null) {
             value = "";
         }

Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java?rev=330927&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java Fri Nov  4 13:54:27 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags.el;
+
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.ELException;
+import javax.servlet.jsp.JspException;
+
+
+public class ParamTag extends org.apache.pluto.tags.ParamTag {
+
+    public String getValue() throws JspException {
+        String string = super.getValue();
+
+        ExpressionEvaluator eval = pageContext.getExpressionEvaluator();
+
+        try {
+            Object evaluated = eval.evaluate(
+                    string,
+                    Object.class,
+                    pageContext.getVariableResolver(),
+                    null
+            );
+
+            if(evaluated != null) {
+                string = evaluated.toString();
+            }
+
+        }
+        catch(ELException el) {
+            throw new JspException(el);
+        }
+        return string;
+    }
+
+}

Added: portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet-el.tld
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet-el.tld?rev=330927&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet-el.tld (added)
+++ portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet-el.tld Fri Nov  4 13:54:27 2005
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+  "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<!-- 
+Copyright 2004 The Apache Software Foundation
+Licensed  under the  Apache License,  Version 2.0  (the "License");
+you may not use  this file  except in  compliance with the License.
+You may obtain a copy of the License at 
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed  under the  License is distributed on an "AS IS" BASIS,
+WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<taglib>
+    <tlibversion>1.0</tlibversion>
+    <jspversion>1.2</jspversion>
+    <shortname>portlet</shortname>
+    <uri>http://portals.apache.org/pluto/portlet-el</uri>
+    <tag>
+        <name>defineObjects</name>
+        <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
+        <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+    <tag>
+        <name>param</name>
+        <tagclass>org.apache.pluto.tags.el.ParamTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>value</name>
+            <required>true</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>actionURL</name>
+        <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>renderURL</name>
+        <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>namespace</name>
+        <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+</taglib>
\ No newline at end of file