Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a Spring MVC compatible UI Framework out there?
    primarykey
    data
    text
    <p>I am recently learning Spring MVC, and i am impressed how easy that is to achieve some common things like <strong>Pagination</strong>. For example i have a controller method like this:</p> <pre><code>@RequestMapping(value="/showAllItems") public String showAllItems(Model model, Pageable pageable) { model.addAttribute("itemPage", itemService.getAllItems(pageable)); return ViewNamesHolder.SHOW_ALL_ITEMS; } </code></pre> <p>While Spring incredibly supports us at the backend by creating this pageable object, as far as i know there isn't any UI Framework which supports this kind of Spring objects at the frontend. After writing this perfect simple Controller method, we are again all alone on the frontend side, about how this pageable object will be displayed.</p> <p>For example there is <strong>Bootstrap</strong>. Beautiful interface, very nice features. This article is a very nice example of how you can integrate Spring MVC with Bootstrap: <a href="http://www.javacodegeeks.com/2013/03/implement-bootstrap-pagination-with-spring-data-and-thymeleaf.html" rel="nofollow">http://www.javacodegeeks.com/2013/03/implement-bootstrap-pagination-with-spring-data-and-thymeleaf.html</a></p> <p>The problem is, we still have to write a lot of code. This is the jsp example from the above article, which at the end produces just a <strong>pagination bar</strong>:</p> <pre><code>&lt;!-- Pagination Bar --&gt; &lt;div th:fragment='paginationbar'&gt; &lt;div class='pagination pagination-centered'&gt; &lt;ul&gt; &lt;li th:class='${page.firstPage}? 'disabled' : '''&gt; &lt;span th:if='${page.firstPage}'&gt;← First&lt;/span&gt; &lt;a th:if='${not page.firstPage}' th:href='@{${page.url}(page.page=1,page.size=${page.size})}'&gt;← First&lt;/a&gt; &lt;/li&gt; &lt;li th:class='${page.hasPreviousPage}? '' : 'disabled''&gt; &lt;span th:if='${not page.hasPreviousPage}'&gt;«&lt;/span&gt; &lt;a th:if='${page.hasPreviousPage}' th:href='@{${page.url}(page.page=${page.number-1},page.size=${page.size})}' title='Go to previous page'&gt;«&lt;/a&gt; &lt;/li&gt; &lt;li th:each='item : ${page.items}' th:class='${item.current}? 'active' : '''&gt; &lt;span th:if='${item.current}' th:text='${item.number}'&gt;1&lt;/span&gt; &lt;a th:if='${not item.current}' th:href='@{${page.url}(page.page=${item.number},page.size=${page.size})}'&gt;&lt;span th:text='${item.number}'&gt;1&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li th:class='${page.hasNextPage}? '' : 'disabled''&gt; &lt;span th:if='${not page.hasNextPage}'&gt;»&lt;/span&gt; &lt;a th:if='${page.hasNextPage}' th:href='@{${page.url}(page.page=${page.number+1},page.size=${page.size})}' title='Go to next page'&gt;»&lt;/a&gt; &lt;/li&gt; &lt;li th:class='${page.lastPage}? 'disabled' : '''&gt; &lt;span th:if='${page.lastPage}'&gt;Last →&lt;/span&gt; &lt;a th:if='${not page.lastPage}' th:href='@{${page.url}(page.page=${page.totalPages},page.size=${page.size})}'&gt;Last →&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>This JSP page is then reusable thanks to the author. But still we need frameworks which handles this kind of things automatically, that is what i call Spring MVC Compatible. And this should seem sth like this on the frontend, which handles the pagination almost automatically:</p> <pre><code>&lt;div springUI:fragment='paginationbar' springUI:object='itemPage'/&gt; </code></pre> <p>Maybe with some additional attributes like firstAndLastButtonsVisible or currentPageDisabled etc.. </p> <p>For the above example, since we have every info we need (pageCount etc.) in the object <em>itemPage</em>, this simplicity (or almost) is possible.</p> <p>Now my question again, is there a very Spring MVC compatible UI Framework out there?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload