1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.myfaces.custom.inputAjax;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 import javax.faces.component.UIComponent;
26 import javax.faces.context.FacesContext;
27 import javax.servlet.jsp.JspException;
28 import java.io.IOException;
29
30 /**
31 * User: treeder
32 * Date: Nov 22, 2005
33 * Time: 12:10:58 PM
34 */
35 public class HtmlMessageTag extends org.apache.myfaces.taglib.html.ext.HtmlMessageTag
36 {
37 private static final Log log = LogFactory.getLog(HtmlMessageTag.class);
38
39
40 protected void encodeEnd() throws IOException
41 {
42 super.encodeEnd();
43 }
44
45 public String getRendererType()
46 {
47 return "org.apache.myfaces.MessageSandbox";
48 }
49
50
51 public void setFor(String aFor)
52 {
53 super.setFor(aFor);
54 String id = getId();
55 //UIComponent comp = getComponentInstance();
56 log.debug("setFor ID WAS: " + id); // Are these tags reused?? The id at this point is set to the last s:message on the page?
57
58 /*if (id == null)
59 {*/
60 // default id so client side scripts can use this (ie: ajax), this will obviously break things if someone specifies an id, so please don't specify an id if using Ajax components!
61
62 id = "msgFor_" + getFor();
63 log.debug("Setting id on MessageTag: " + id);
64 setId(id);
65 setForceId("true");
66 /*if(comp != null){
67 log.debug("SETTING COMP ID");
68 comp.setId(id);
69 }*/
70 //}
71
72 }
73
74 protected UIComponent findComponent(FacesContext context) throws JspException
75 {
76 return super.findComponent(context);
77 }
78 }