Can't make navigation in Vaadin8.

Hello I’m using Vaadin 8.2 version.
I’m using the very populary tutorial “side-menu with Vaadin8”.
I’m literally rewriting the code and at the line

navigator.addView(“/”, DefaultView.class);

I had a BUG,

navigator.addView(“view1”,View1.class);
works properly…

Use “” instead of “/” if you want to map a view to the context root.

-Olli

It doesn’t work also.
Maybe I need to add some dependencies or plugins?

I’m working on a website project.
I already succesfully add my postgreSQL DB to this, im using jdbcTemplate and I can’t make navigation…
I had all main project in the VaadinUI class and I just simply wanna add Button which will hyperlink me to localhost8080:/registration … I dont know’ what to do, maybe I should rewrite the code without VaadinUI class?

I can’t find any tutorial online, I mean everything I tried didn’t work

Navigator should work without any additional dependencies. Do you get an exception in your log?

By the way, here’s the official documentation for Vaadin 8’s Navigator: https://vaadin.com/docs/v8/framework/advanced/advanced-navigator.html

I know it exists but It just clearly doesn’t work

Stupid question but just to rule out all potential issues - you’re sure you’re using Vaadin 8 as Navigator doesn’t exist in Vaadin 10. Anyway, maybe some of the people who posted here had similar issues:
https://vaadin.com/blog/community-answer-implementing-a-side-menu-with-view-navigation

I made a very minimal sample project here: https://github.com/OlliTietavainenVaadin/v8-navigation . There are two Views, DefaultView and AdminView. DefaultView has an empty string as its viewName and so it’s loaded by default. You can use the buttons on the menu or manually edit the URL to navigate between the views.

-Olli

EDIT:
I have fully functionally database-related website.
But all methods touching the database are in VaadinUI.

I did side-menu bar, so my view is now in Class View1 and errors are appearing when I wanna access my DataBase.
So basically the problem is… why I can’t acces database from Class View1? ( It extends Composite, not UI now.) :frowning:

Okay, I know.
My UserService is injecting Bean into the VaadinUI class beacuse it is @SpringUI

Maybe I can write something like that in my Class View1? How to make this injectable?

If you’re using Spring, you should use the enhanced Spring navigation as well (and make the views Spring managed beans). There’s documentation here: https://vaadin.com/docs/v8/framework/advanced/advanced-spring.html