Overview of multipage apps

With Jt.navigation and Jt.page you can declare any Java class as a page in your app. Furthermore, you can define common elements for your pages in your entrypoint file (the file you pass to jeamlit run). With these methods, your entrypoint file becomes like a picture frame shared by all your pages.

You must include Jt.navigation in your entrypoint file to configure your app's navigation menu. This is also how your entrypoint file serves as the router between your pages.

A page has three identifying pieces as follows:

  • Page class: This is a Java class with the page's source code.
  • Page title: This is how the page is identified within the navigation menu and the browser tab. See looks_one and looks_two.
  • Page URL path: This is the relative path of the page from the root URL of the app. See looks_3.

Additionally, a page can have 1 icon as follows:

  • Page icon: This is the icon next to your page label in the navigation menu. See looks_5.
  • Page favicon support is not implemented yet

1. Page title, 2.Page title, 3. Page URL path, 4.Page favicon, 5. Page icon

If you use Jt.page without declaring the page title or URL pathname, Jeamlit automatically determines the page title and URL path based on the Class name. This section describes this naming convention.

For example, Jt.page(MyPage.class) will have:

  • title: My Page → Jeamlit assumes Camel Case
  • url path: /MyPage → Jeamlit simply uses the class simple name

The primary way users navigate between pages is through the navigation widget. The menu that appears in the sidebar is generated when Jt.navigation is used. When a user clicks a page of the navigation widget, the app reruns and loads the selected page. Optionally, you can hide the default navigation UI with Jt.navigation(...).hidden() and build your own with Jt.pageLink.

If you need to programmatically switch pages, use Jt.switchPage.

Users can also navigate between pages using URLs as noted above.

priority_high

Important

Navigating between pages by URL creates a new browser session. In particular, clicking markdown links to other pages resets the Session State. In order to retain values in Jt.session_state, handle page switching through Jeamlit navigation commands and widgets, like Jt.navigation, Jt.switchPage, Jt.pageLink, and the built-in navigation menu.

If a user tries to access a URL for a page that does not exist, they will see a 404 page saying "Page not found."

Page not found
forum

Still have questions?

Go to our discussions forum for helpful information and advice from Jeamlit experts.