在没有 Web 流的情况下在 Spring 中管理路径面包屑的最佳实践

发布于 2024-09-03 06:21:02 字数 348 浏览 1 评论 0原文

我正在从事一个项目,我需要向用户显示路径面包屑,例如

主页(链接到主页)>> (页面名称)

首页>>联系方式

和联系人等

联系方式>>创建
联系方式>>编辑

等。

是否有最佳实践如何在 Spring 中执行此操作而不使用 Spring Web Flow?我没有使用 Spring Web Flow,而只是使用 Spring MVC。

I am engaged in a project where I need to show path bread crumbs to the user like

Home (This is linked to home page) >> (page name)

and like

Home >> contacts

and in contacts like

Contacts >> create
Contacts >> edit

etc.

Is there a best practice how to do this in spring without he usage of spring web flow? I am not using spring web flow and simply using the spring MVC.

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

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

发布评论

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

评论(3

清风疏影 2024-09-10 06:21:02

如果您不使用 Spring MVC,我不确定为什么必须在 Spring 中执行此操作。

根据站点的结构和 URL 结构,您可能希望将 URL 解析为可读的内容。

另一种选择是采用某种推/弹出机制,但由于浏览器有一个后退按钮,该按钮不会向服务器发出信号,这通常会导致灾难。

I'm not sure why you'd have to do this in Spring if you're not using Spring MVC.

Depending on the site's structure and the URL structure, you might want to parse the URL into something readable.

Another option is to have some sort of push/pop mechanism but since browsers have a back button which does not signal the server this is often a recipe for disaster.

廻憶裏菂餘溫 2024-09-10 06:21:02

我不确定面包屑是否有通用的解决方案。以下是一些变体:

  • 使用 URL 结构。对于 spring mvc,这实际上是一个非常好的选择,因为它(从 2.5 开始)在漂亮的结构化 URL 上回复了很多,
  • 让每个页面(视图)在面包屑中标识自己的路径(通过请求参数)。它不会
  • 将当前步骤放入会话中。如果使用多个选项卡/窗口,这会中断,因此您必须使用 windowId.. 并实质上推出“残缺的”网络流。

I'm not sure there is any universal solution for breadcrumbs. Here are a few variants:

  • use the URL structure. With spring mvc this is actually a very good option, since it (since 2.5) replies a lot on nice, structured URLs
  • have each page (view) identify its own path in the breadcrumb (via a request parameter). It's not
  • place current steps in session. This would break if multiple tabs/windows are used, so you will have to use a windowId.. and essentially roll-out a "crippled" webflow.
假扮的天使 2024-09-10 06:21:02

这种面包屑有时称为回家路径 导航。

如果您可以用 XML 捕获站点布局,则可以使用 XSL 来生成面包屑。相同的 XML 站点布局文档也可用于生成侧面导航菜单。

另请参阅:分离面包屑(回家路径)导航使用 XML/XSL 的内容。

This sort of breadcrumbs is sometimes called homeward path navigation.

If you can capture your site layout in XML then an XSL could be used to generate the breadcrumbs. The same XML site layout document could also be used to generate a side navigation menu.

See also: Separating breadcrumb (homeward path) navigation from content using XML/XSL.

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