Advertisement
Guest User

CustomTag

a guest
Dec 2nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package testpack;//define pkg
  2.  
  3. import java.io.IOException; //mandatory imports, exception
  4.  
  5. import javax.servlet.jsp.JspException; //jsp exc
  6. import javax.servlet.jsp.JspWriter; //jsp writer
  7. import javax.servlet.jsp.tagext.SimpleTagSupport; //simple tag support tag
  8.  
  9. public class CustomTag extends SimpleTagSupport { //extends simpletagsupport
  10.  
  11. private String c; //field var
  12.  
  13. public void setColor(String c) { //setter
  14. this.c = c;
  15. }
  16.  
  17. @Override
  18. public void doTag() throws JspException, IOException { //dotag throws these two exceptions
  19. // TODO Auto-generated method stub
  20. super.doTag(); //super.doTag method calls the superclass method
  21. JspWriter out = getJspContext().getOut(); //create out obj
  22. out.print("<h1 style=\"color:"+c+"\">Student Marks</h1>"); //print the heading
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement