View Javadoc

1   /*
2    * Copyright 2000-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.portals.bridges.struts.taglib;
17  
18  import javax.servlet.ServletRequest;
19  
20  import org.apache.portals.bridges.struts.PortletServlet;
21  
22  /***
23   * Supports the Struts html-el:form tag to be used within a Portlet context.
24   * 
25   * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
26   * @version $Id: ELFormTag.java 188222 2005-01-20 02:41:15 +0100 (Thu, 20 Jan 2005) ate $
27   */
28  public class ELFormTag extends org.apache.strutsel.taglib.html.ELFormTag
29  {
30      /***
31       * Modifies the default generated form action url to be a valid Portlet ActionURL
32       * when in the context of a {@link PortletServlet#isPortletRequest(ServletRequest) PortletRequest}.
33       * @return the formStartElement
34       */
35      protected String renderFormStartElement()
36      {
37          if ( PortletServlet.isPortletRequest(pageContext.getRequest() ))
38          {
39              return TagsSupport.getFormTagRenderFormStartElement(pageContext,super.renderFormStartElement());
40          }
41          else
42          {
43              return super.renderFormStartElement();
44          }
45      }
46  }