开发者

How do JSP tag files and libraries work?

开发者 https://www.devze.com 2023-03-06 18:25 出处:网络
I\'ve been learning about JSPs and came across tag files and libraries. I know that they are custom actions and useful for pointing out errors instead of using JavaBeans for example, but I still don\'

I've been learning about JSPs and came across tag files and libraries. I know that they are custom actions and useful for pointing out errors instead of using JavaBeans for example, but I still don't unders开发者_如何学Gotand how they work. Lets say for example you do:

<jsp:directive.attribute name = "amount" required = "true" />

And later, assuming that calc is defined using jsp:useBean, amount can be used by:

<c:set target="${calc}" property = "amount" value ="${amount}" />

But what happens behind the scenes?


${calc} represents value of variable calc which may be there in pageCOntext,request,session,Servletcontext

By the statement

<c:set target="${calc}" property = "amount" value ="${amount}" />

it will store value in calc var's amount represented by value

Behind the scene it would be

calc.setAmount(amount);


Tag files are custom tag handlers which are written in JSP. These jsp are converted to java tag handlers by the JSP compiler.

0

精彩评论

暂无评论...
验证码 换一张
取 消