tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan HÃ¥kans <>
Subject RE: use JSP Tags and jsp variable
Date Thu, 05 Jul 2001 12:14:54 GMT
Since you are fetching the String by using pageContext.getAttribute,
you must have set it on the jsp-page with pageContext.setAttribute.

Note that if no scope is specified it implies page scope.


-----Original Message-----
From: Andrea Gianni []
Sent: den 5 juli 2001 09:12
Subject: Re: use JSP Tags and jsp variable

At 10.37 04/07/01 -0400, you wrote:
>Andrea Gianni wrote:
>>1^ Problem :
>>I tryed this
>><MT:MiaTagLibrary initValue="<%=initValues%>" >
>>         <jsp:include page="pp.jsp" />
>can i see your code in MiaTagLibrary
Here the code, what I don't understand is that If I put iside my tag a
static String al works

public class MiaTagLibrary extends BodyTagSupport {

     static int cont =0;
     private String initValue="-1";
     /** Creates new MiaTagLibrary */
     public MiaTagLibrary()

     public void setInitValue(String nval)

     public String getInitValue()

     public int doStartTag()

         // Here I search barba, a String defined in the jsp


         catch(Exception e)

         return EVAL_BODY_TAG;

     public int doAfterBody() throws JspTagException

             BodyContent bc = getBodyContent();
             String corpo = "vuoto";
             if (bc!=null)
              corpo= bc.getString();
             getPreviousOut().print("Il tag ha corpo "+corpo);

         catch(Exception e)
         return SKIP_BODY;

    public int doEndTag()
         return EVAL_PAGE;

>>2^ Problem
>>how I can read in a tagLib a Java variable defined in a jsp Page directly
>>I think that I can use pageContext(<name of the variable>, 1); but don't
>use TagExtraInfo.

Sorry I don't understand, I have a JSP like this

         String barba="pippo";
         String p2="pluto";

and I want to read these variables in my tag ( by the way I need to access
all the variables defined in the jsp without knowing them ), how the
tagExtraInfo should be written ? ( all examples I read talk about the
opposite problem, put a tag variable into jsp ).



Ing. Andrea Gianni
Software Engineer
Gruppo Monetica e Servizi
Area Internet Professional
Infogroup S.p.a.
Via delle Panche, 140
50141 Firenze
Tel. 055.436.5647
Fax. 055.436.5735

View raw message