/**
 * XXXX
 * Inserte aquí la descripción del tipo.
 * Fecha de creación: (10/05/07)
 */    
package com.ejie.p06b.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.ejie.p06b.general.P06BConstantes;
import com.ejie.p06b.log.P06BLog;
import com.ejie.p06b.util.P06BResources;
import com.ejie.p06b.xlnet.P06BPerfilUsuario;

public class P06BResEtiquetasTag extends TagSupport{
	private String resource;
	   
	public void setResource(String resource){
        this.resource = resource;
    }
	
	public int doStartTag() throws JspException {
	    try{
	    	HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
	    	P06BPerfilUsuario lPerfil = (P06BPerfilUsuario)request.getSession().getAttribute(P06BConstantes.P06B_VAR_PERFIL_USUARIO);
	    	
	    	P06BResources res = (P06BResources)request.getSession().getAttribute(P06BConstantes.P06B_RES_SES_ETIQUETAS);
	    	P06BLog.send(2,this, "res null=" + (res == null));
	    	P06BLog.send(2,this, "resource=" + resource);
	    	if (res != null) {
	    		P06BLog.send(2,this, "res=" + res.toString());
	    	}

	    	pageContext.getOut().print(res.get(resource));   
	    } catch (Exception e) {
	        throw new JspException ("Error: IOException" + 
			e.getMessage());
	    }
	    return SKIP_BODY;
	}
	
    public int doEndTag() throws JspException {
        return EVAL_PAGE;
    }
}
