Search code examples
javajspjsp-tags

What is a JSP tag?


I'm coming from a .NET background and trying to learn Java. I keep seeing references to tags and tag handlers, etc.

Is there an equivalent .NET construct?


Solution

  • Yes. <% ... %> is what you get for the jsp tag. Tag Handlers are similar to the RUNAT="SERVER" attribute you can add to many HTML tags, except they go much further and allow you to create custom tags to fit your needs. For example you could create a tag called DATETIMEHERE that when encountered simply output the date/time.

    E.g.

    <span class="somsCSSClass"><DATETIMEHERE /></span>
    

    In ASP.NET MVC you could create a custom ViewEngine and do something as robust as Tag Handlers very easily.