import java.io.IOException;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.log4j.Logger;
public class ErrorCodes extends TagSupport {
private static Logger logger = Logger.getLogger(ErrorCodes.class);
private String codes;
private String portletnamespace;
public void setCodes(String codes) {
this.codes = codes;
}
public void setPortletnamespace(String namespace) {
this.portletnamespace = namespace;
}
public int doStartTag() throws JspException {
try {
StringBuffer sb = new StringBuffer();
StringTokenizer tokenizer = new StringTokenizer(codes,",");
ResourceBundle bundle = ResourceBundle.getBundle("com.ibm.ahb.idt.nl.AlHilalPortalPortletResourceMessages");
while (tokenizer.hasMoreElements()) {
String token = (String) tokenizer.nextElement();
String value=bundle.getString(token);
if(value!=null)
sb.append("");
}
pageContext.getOut().println(sb.toString());
} catch (IOException ioe) {
logger.error("Error: ErrorCodes while writing to client");
}
return SKIP_BODY;
}
}
-----------------------------------------------------------------------
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-
jsptaglibrary_2_0.xsd"
version="2.0">
---------------------------------------------------------------------------
Please write below code in jsp
<%@ taglib uri="/WEB-INF/lib/errorcodetaglib.tld" prefix="codes" %>
No comments:
Post a Comment