I want to create a cudtom jsp tag which accesses a Vector object in the request scope 
and displays it in a specified format.
  So i wrote a tld with a single attribute name

and my setName method looks like 

private String name;
public void setName(String name)
{
this.name=name;
}

and i tried to access the object in my doStartTag like
Vector v=(Vector)pageContext.getRequest().getAttribute(name);
but the resultant vector is null
but i am getting the name string correctly

my java code is 


package com.c2rmnet.struts.taglib;

import java.io.IOException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import java.util.List;
/**
 * @author [EMAIL PROTECTED]
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class TableFormat extends TagSupport {
        
        //JspWriter writer=pageContext.getOut();
        private String name;
        public TableFormat()
        {
        
        }
        
        public int doStartTag() throws JspException
        {
                int i=0;
                
                java.lang.Object 
table=(java.lang.Object)pageContext.getRequest().getAttribute("test");
                String cls;//=(pageContext.getClass()).toString();
                        /**while(i<=table.size())
                {*/
                                try{cls=String.valueOf(table);}catch (Exception 
e){cls=e.toString();}
                         
                        try {
                                                pageContext.getOut().write("<h1><font 
color=\"red\">"+cls+"<h1></font><br>");
                                        } catch (IOException ioe) {
                                                throw new 
JspException(ioe.getMessage());
                                        }
                                        catch(Exception e){
                                                try{
                                        pageContext.getOut().write("Some 
Exception"+e.toString());
                                                }catch(Exception t){}
                                        }
                        //              i++;
                //}
                        return EVAL_BODY_INCLUDE;
        }
        public void setName(String name)
        {
        this.name=name;
        }
}



wat is the problem


 also suggest some examples which suits this context
    vinu






    

Reply via email to