Announcement Announcement Module
Collapse
No announcement yet.
Access page.hasPreviousPage() in using Spring EL in a Web page? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access page.hasPreviousPage() in using Spring EL in a Web page?

    org.springframework.data.domain.Page has two methods which would be useful for creating a paginator component in a Web page: hasPreviousPage() and hasNextPage().

    However, if I am using Thymeleaf, and I configure the template engine as follows:

    Code:
    @Bean 
    public SpringTemplateEngine templateEngine() {
    	SpringTemplateEngine engine = new SpringTemplateEngine();
    	engine.setTemplateResolver(templateResolver());
    	return engine;
    }
    I have so far failed to find a valid expression to access either method in a Web page. None of the following work:

    ${page.previousPage}
    ${page.hasPreviousPage}
    ${page.hasPreviousPage()}


    What is the right way to do this in an expression, if any, using these two methods? (Yes, I know, I can write th:if="${not page.firstPage}" ... I'm doing that right now, while waiting for a reply.)

  • #2
    Replying to my own question.

    It seems as though something got stuck in tcServer. After a restart, ${page.hasPreviousPage()} worked ... as originally expected. This sure had me stumped for awhile.

    Comment

    Working...
    X