Jsp & servlets building custom tags

Induroopa Danthuluri
2 min readJun 10, 2021



We can make custom tags in jsp and they can be self contained too.

On custom tags we can add attributes ,description and type too .

here we created a custom tag named demo.tag page then calling that custom tag into jsp file



In taglib we are giving prefix as “d”.Hence we can access the demo.tag file here using the <d:demo/>

Adding attributes to custom tag

Modifying the file demo.tag

Here I am adding attribute and using expressions to call it

In <strong> tag we are using${paratmeter} which is expression

A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client.



Final output from running demoJSPTag.jsp file

Adding restriction on type as integer

we are passing string entity and giving type as integer so error

now if we run the file then page will be crashed

change parameter to int

hence problem will be solved