Couldn't compile the Tag Handler class!!
843838May 11 2007 — edited Jun 25 2007Here is my code snippet
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspContext.*;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
public class AdvisorTagHandler extends SimpleTagSupport
{
private String user;
public void doTag() throws JspException, IOException
{
getJspContext().getOut().write("Hello" + user + "<br>");
getJspContext().getOut().write("Your Advice is : " +getAdvice());
}
public void setUser(String user)
{
this.user=user;
}
String getAdvice()
{
String[] adviceStrings = {"That color is not working for you", "You should call back", "You might want to rethink that haircut."};
int random = (int)(Math.random() * adviceStrings.length);
return adviceStrings[random];
}
}
the error i got while compiling is
AdvisorTagHandler.java:3: package javax.servlet.jsp.JspContext does not exist
import javax.servlet.jsp.JspContext.*;
^
AdvisorTagHandler.java:4: cannot resolve symbol
symbol : class SimpleTagSupport
location: package tagext
import javax.servlet.jsp.tagext.SimpleTagSupport;
^
AdvisorTagHandler.java:6: cannot resolve symbol
symbol : class SimpleTagSupport
location: class com.learn.AdvisorTagHandler
public class AdvisorTagHandler extends SimpleTagSupport
^
AdvisorTagHandler.java:11: cannot resolve symbol
symbol : method getJspContext ()
location: class com.learn.AdvisorTagHandler
getJspContext().getOut().write("Hello" + user + "<br>");
^
AdvisorTagHandler.java:12: cannot resolve symbol
symbol : method getJspContext ()
location: class com.learn.AdvisorTagHandler
getJspContext().getOut().write("Your Advice is : " +getAdvice())
;
^
5 errors
Kindly somebody help me out to get the SimpleTagSupport class file..
I searched in jstl.jar and standard.jar this class is not there in these 2 jar files..
Where do i find this class file..
thanks in advance
Chithrakumar