如何将一个jsp中的组件加载到另一个jsp中?

发布于 2024-12-13 03:15:01 字数 495 浏览 1 评论 0原文

有人告诉我我可以通过他的 id 从 jsp 文件加载单个组件,我正在使用这个:

            <sj:div id="div1" class="text"
                href="%{urlObtenerCaracteristicasTipoProyecto}"
                indicator="indicator1"
                reloadTopics="reloadCaracteristicasTipoProyecto"
                deferredLoading="true" formIds="frmProyectoGubernamental">
            </sj:div>

但是那段代码检索整个 jsp 文件,包括装饰器,我只对从一个 jsp 检索一个组件感兴趣文件插入到 div1 所有者的 jsp 文件中。

我该怎么做?预先感谢您的任何帮助。

I was told I could load a single component from a jsp file through his id, I'm using this:

            <sj:div id="div1" class="text"
                href="%{urlObtenerCaracteristicasTipoProyecto}"
                indicator="indicator1"
                reloadTopics="reloadCaracteristicasTipoProyecto"
                deferredLoading="true" formIds="frmProyectoGubernamental">
            </sj:div>

but that piece of code retrieves the whole jsp file, decorators included, I'm only interested in retrieving just one component from one jsp file to insert into the div1 owner's jsp file.

How can I do this? Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼中杀气 2024-12-20 03:15:01

如果您只想返回特定的 HTML,则只需返回该 HTML。最简单的方法是使用一个操作来渲染有问题的 JSP 部分,例如特定

的内容等。另一个选项是返回 JSON 并渲染使用该 JSON 通过 JavaScript 生成 HTML。

您无法通过在 URL 上放置任何内容来检索 HTML 的一部分 - 请尝试从地址栏进行操作,最多只能滚动到该位置。

(显然,除非系统使用 URL 来确定发回的内容。)

If you only want specific HTML returned, you need to return only that HTML. The easiest way to do that is to have an action that renders just the portion of JSP in question, like the contents of a specific <div>, etc. The other option is to return JSON and render HTML via JavaScript using that JSON.

You can't retrieve just a portion of HTML by putting anything on the URL--try it from the address bar, at best you'll scroll to that location.

(Unless the system uses the URL to determine what's sent back, obviously.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文