How to call java method in JSTL? [duplicate]

孤街浪徒 提交于 2019-12-05 21:43:06

Simply create an object of the class using <jsp:useBean> and call the method using JavaServer Pages Standard Tag Library or Expression Language that is more easy to use and less error prone.

sample code:

<jsp:useBean id="test" class="com.x.y.z.XYZ"/>

${test.methodXYZ(object,"myString")}

Read more about Implicit Objects that might help you.

Try with this:

<c:out value="${XYZbean.makeCall(someObjBean, 'value')}" />

For resolve this we need create your own tag. (in .tld file)

and need to write one java class for this tag.

After this you can call method within that your own class and set result to pageCotext to retrive it on jsp.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!