View Javadoc

1   /*
2    * $Id: FormTag.java 474191 2006-11-13 08:30:40Z mrdon $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.views.jsp.ui;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.apache.struts2.components.Component;
27  import org.apache.struts2.components.Form;
28  import org.apache.struts2.dispatcher.mapper.ActionMapper;
29  
30  import com.opensymphony.xwork2.inject.Inject;
31  import com.opensymphony.xwork2.util.ValueStack;
32  
33  
34  /***
35   * @see Form
36   */
37  public class FormTag extends AbstractClosingTag {
38  
39      private static final long serialVersionUID = 2792301046860819658L;
40  
41      protected String action;
42      protected String target;
43      protected String enctype;
44      protected String method;
45      protected String namespace;
46      protected String validate;
47      protected String onsubmit;
48      protected String portletMode;
49      protected String windowState;
50      protected String acceptcharset;
51  
52      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
53          return new Form(stack, req, res);
54      }
55  
56      protected void populateParams() {
57          super.populateParams();
58          Form form = ((Form) component);
59          form.setAction(action);
60          form.setTarget(target);
61          form.setEnctype(enctype);
62          form.setMethod(method);
63          form.setNamespace(namespace);
64          form.setValidate(validate);
65          form.setOnsubmit(onsubmit);
66          form.setPortletMode(portletMode);
67          form.setWindowState(windowState);
68          form.setAcceptcharset(acceptcharset);
69      }
70  
71  
72      public void setAction(String action) {
73          this.action = action;
74      }
75  
76      public void setTarget(String target) {
77          this.target = target;
78      }
79  
80      public void setEnctype(String enctype) {
81          this.enctype = enctype;
82      }
83  
84      public void setMethod(String method) {
85          this.method = method;
86      }
87  
88      public void setNamespace(String namespace) {
89          this.namespace = namespace;
90      }
91  
92      public void setValidate(String validate) {
93          this.validate = validate;
94      }
95  
96      public void setOnsubmit(String onsubmit) {
97          this.onsubmit = onsubmit;
98      }
99  
100     public void setPortletMode(String portletMode) {
101         this.portletMode = portletMode;
102     }
103 
104     public void setWindowState(String windowState) {
105         this.windowState = windowState;
106     }
107 
108     public void setAcceptcharset(String acceptcharset) {
109         this.acceptcharset = acceptcharset;
110     }
111 }