通过Ajax调用JSP自定义标签tld

时间:2022-11-26 13:35:42

So I am currently trying to implement AJAX functionality to my webapp. I currently have all the Tag Library, Tag Handlers, set up properly, so that if I call the Tags when the page is fully refreshing. All these custom tags work. However, I have actually never implemented ajax in my life and is currently stuck on how to proceed to call these tags dynamically based on the changes in the webpage. E.X:

所以我目前正在尝试为我的webapp实现AJAX功能。我目前已经正确设置了所有标记库,标记处理程序,以便在页面完全刷新时调用标记。所有这些自定义标签都有效但是,我实际上从来没有在我的生活中实现过ajax,目前仍然在如何根据网页的变化动态调用这些标签。 E.X:

Custom Tag library under -->/WEB-INF/tld

自定义标签库位于 - > / WEB-INF / tld下

Tag Handlers --> classes/ClassHandlers/Tag1...TagXXX

标记处理程序 - > classes / ClassHandlers / Tag1 ... TagXXX

With the above calling the following tag in the JSP file works perfectly:

通过上面的调用,JSP文件中的以下标记可以完美地运行:

<tagLib:tagName Attribute1="" Attribute2="">

However, how can I get this to be dynamically inserted by Ajax?

但是,如何通过Ajax动态插入?

Please let me know if I can provide any more details.

如果我能提供更多细节,请告诉我。

1 个解决方案

#1


Well, I would said that it is impossible. AJAX and JSP are two incompatible technologies. JSP tags can be used only on server side (during generating HTML) while AJAX is a client side technology (it runs in user browser). You can read more about client-server model here.

好吧,我会说这是不可能的。 AJAX和JSP是两种不兼容的技术。 JSP标记只能在服务器端使用(在生成HTML期间),而AJAX是客户端技术(它在用户浏览器中运行)。您可以在此处详细了解客户端 - 服务器模型。

#1


Well, I would said that it is impossible. AJAX and JSP are two incompatible technologies. JSP tags can be used only on server side (during generating HTML) while AJAX is a client side technology (it runs in user browser). You can read more about client-server model here.

好吧,我会说这是不可能的。 AJAX和JSP是两种不兼容的技术。 JSP标记只能在服务器端使用(在生成HTML期间),而AJAX是客户端技术(它在用户浏览器中运行)。您可以在此处详细了解客户端 - 服务器模型。