| Method from org.apache.struts.taglib.html.HtmlTag Detail: |
public int doEndTag() throws JspException {
TagUtils.getInstance().write(pageContext, "< /html >");
// Evaluate the remainder of this page
return (EVAL_PAGE);
}
Process the end of this tag. |
public int doStartTag() throws JspException {
TagUtils.getInstance().write(this.pageContext, this.renderHtmlStartElement());
return EVAL_BODY_INCLUDE;
}
Process the start of this tag. |
protected Locale getCurrentLocale() {
Locale userLocale = TagUtils.getInstance().getUserLocale(pageContext, Globals.LOCALE_KEY);
// Store a new current Locale, if requested
if (this.locale) {
HttpSession session = ((HttpServletRequest) this.pageContext.getRequest()).getSession();
session.setAttribute(Globals.LOCALE_KEY, userLocale);
}
return userLocale;
} Deprecated! This - will be removed after Struts 1.2.
Return the current Locale for this request. If there is no locale in the session and
the locale attribute is set to "true", this method will create a Locale based on the
client's Accept-Language header or the server's default locale and store it in the
session. This will always return a Locale and never null. |
public boolean getLang() {
return this.lang;
}
Returns true if the tag should render a lang attribute. |
public boolean getLocale() {
return (locale);
} Deprecated! This - will be removed after Struts 1.2.
|
public boolean getXhtml() {
return this.xhtml;
}
|
public void release() {
this.locale = false;
this.xhtml = false;
this.lang=false;
}
Release any acquired resources. |
protected String renderHtmlStartElement() {
StringBuffer sb = new StringBuffer("< html");
String language = null;
String country = "";
if (this.locale) {
// provided for 1.1 backward compatibility, remove after 1.2
language = this.getCurrentLocale().getLanguage();
} else {
Locale currentLocale =
TagUtils.getInstance().getUserLocale(pageContext, Globals.LOCALE_KEY);
language = currentLocale.getLanguage();
country = currentLocale.getCountry();
}
boolean validLanguage = ((language != null) && (language.length() > 0));
boolean validCountry = country.length() > 0;
if (this.xhtml) {
this.pageContext.setAttribute(
Globals.XHTML_KEY,
"true",
PageContext.PAGE_SCOPE);
sb.append(" xmlns=\"http://www.w3.org/1999/xhtml\"");
}
if ((this.lang || this.locale || this.xhtml) && validLanguage) {
sb.append(" lang=\"");
sb.append(language);
if (validCountry) {
sb.append("-");
sb.append(country);
}
sb.append("\"");
}
if (this.xhtml && validLanguage) {
sb.append(" xml:lang=\"");
sb.append(language);
if (validCountry) {
sb.append("-");
sb.append(country);
}
sb.append("\"");
}
sb.append(" >");
return sb.toString();
}
Renders an <html> element with appropriate language attributes. |
public void setLang(boolean lang) {
this.lang = lang;
}
Sets whether the tag should render a lang attribute. |
public void setLocale(boolean locale) {
this.locale = locale;
} Deprecated! This - will be removed after Struts 1.2.
|
public void setXhtml(boolean xhtml) {
this.xhtml = xhtml;
}
|