• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

compilation error for EVAL_BODY_AGAIN

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying out a custom tag example. I am running tomcat5 andd have the jsp-api.jar in my classpath. I know that is okay because I have been able to execute Simple tags. Anyway, here is the custom tag

package foo;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;



public class CustomTagTest3 extends TagSupport {

int movieCounter;
String[] movies = {"Amelie","Sandy beaches","Veer zara","SomethingElse"};

public int doStartTag() throws JspException {
movieCounter = 0;

return EVAL_BODY_INCLUDE;
}

public int doAfterBody() throws JspException {

if (movieCounter < movies.length) {
pageContext.setAttribute("movie",movies[movieCounter]);
movieCounter++;
return EVAL_BODY_AGAIN;
}
else {
return SKIP_BODY;
}
}
public int doEndTag() throws JspException {

return EVAL_PAGE;
}
}

I am getting the below compilation error.

C:\HEADFI~1\CustomTagTest3>javac foo\CustomTagTest3.java
foo\CustomTagTest3.java:26: cannot resolve symbol
symbol : variable EVAL_BODY_AGAIN
location: class foo.CustomTagTest3
return EVAL_BODY_AGAIN;
^
1 error


I know that EVAL_BODY_AGAIN is a valid return value for doAfterBody(). What am I missing ?
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I tried that and it still did not work. Anyway, TagSupport should do for doAfterBody() method. Does the class compile for you ? Thanks for your help!
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ritu.
I think its a compiler error...And its occured bcoz u have not imported javax.servlet.jsp.tagext.Tag. all the implicit return types like EVAL_BODY_INCLUDE , etc. are final variables of this interface....Hope this helps.
[ January 26, 2005: Message edited by: Nischal Tanna ]
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have imported the TagSupport class which should be enough. Anyway, I tried importing the Tag interface too. Its still giving me a compiler error. I am so frustated...
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just tried your code and it compiles for me.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your classpath again
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm..I rearranged some of the jar files in my classpath and the code compiled! Thanks, Ben! Next time, I will just have to make my mind work in more directions than just posting immediately. Thanks for all your help.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic