Vaadin 7 URL导航hashbang [英] Vaadin 7 url navigation hashbang

查看:82
本文介绍了Vaadin 7 URL导航hashbang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图完全理解Vaadin 7中的导航.我阅读了 Vaadin书中的导航器"一章,但仍然存在一些实际问题.

I'm trying to fully understand Navigation in Vaadin 7. I read the Navigator Chapter in the Vaadin book but still have some practical questions.

基本上,它与使用爆炸(!)有关.我什么时候需要设置它,为什么?

Basically it is about using the bang (!). When do I need to set it and why?

  • 有一个视图(myview)
  • 有一个参数(param = X)
  • 该参数用于标识显示的标签

浏览器历史记录示例:
我需要设置bang(!)或在浏览器中单击不起作用,因为未传递参数,因此视图输入功能:

Example for browser history:
I need to set the bang (!) or clicking back in the browser does not work, because the parameters is not passed the the views enter function:

private void showInfo(String info) {
    infoLabel.setValue(info);
    Page.getCurrent().setUriFragment("!" + "myview/param=" + info, false);
}

单击按钮后进行导航的示例:
我一定不要设置bang(!),否则url片段将更改为#!myview//param = X"(包含double/)

Example for navigation after button click:
I must not set the bang (!) or else the url fragment changes to "#!myview//param=X" (contains double /)

@Override
public void buttonClick(ClickEvent event) {
    getUI().getNavigator().navigateTo("myview/param=X")
}

我是在这里混入两个概念吗,还是有一个实用程序可以为我做到这一点,而我却不知道呢?还是我只需要了解这两种情况并自己决定爆炸的事?

Am I mixing two concepts here or is there a utility that does that for me and I'm not knowing it? Or do I just have to know about these 2 cases and decide about the bang myself?

谢谢

推荐答案

您无需设置'!'完全可以-除非您要强制搜索引擎对您的网站进行爬网(请参见 GoogleDevelopers规范).甚至有人说,这些哈希爆炸是非常糟糕的UI习惯.

You don't need to set the '!' at all - except you want force your sites to be crawled by search engines (see GoogleDevelopers Spec). Some people even say, these hash bangs are very bad UI practice.

还是您的应用程序要求其全部内容由搜索引擎索引?

Or is it a requirement for your application that its whole content is indexed by search engines ?

这篇关于Vaadin 7 URL导航hashbang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆