Spring web stream: transition through view states

In the spring web stream, I need to implement a navigation bar that will allow you to "back off" or resume the stream to one of the previous views.

For instance:

  • View 1 = login
  • View 2 = My Details
  • View 3 = My Messages
  • View 4 = Close session

In this example, I would like to return to viewing 2 from 4 pages.

+3
source share
2 answers

It depends on how you are going to do it. If you do this in one thread, you will have something like this:

<view-state id="loginView" view="login.jsp">
    <action-state bean="someBean" method="login" />
    <transition on="success" to="informationView" />
</view-state> 

<view-state id="informationView" view="information.jsp">
    <render-actions>
        <action-state bean="someBean" method="retrieveInformation" />
    </render-actions>
    <transition on="forward" to="messageView" />
    <transition on="back" to="loginView" />
</view-state>

<view-state id="messageView" view="message.jsp">
    <render-actions>
        <action-state bean="someBean" method="retrieveMessage" />
    </render-actions>
    <transition on="forward" to="closeView" />
    <transition on="back" to="informationView" />
</view-state>

<view-state id="closeView" view="logout.jsp">
    <transition on="jumpBack" to="informationView" />
</view-state>

Going "jumpBack" to "closeView" will take you back to view state # 2, which is your information view.

. : , , , .

, , - login- > information- > message- > close.

"returnToInformation" .

= "returnToInformation" to = "returnToInformation" .

"returnToInformation" .

= "returnToInformation" = "displayInformationPage", .

+4

, , . , , , . , .

, , ( , , , , , ).

JSP, , .

, .

.

0
source

Source: https://habr.com/ru/post/1697928/


All Articles