In diesem Code bekomme ich authorId für jeden Autor den Namen von bookListArray
und zeigen Sie es für jedes Buch, mit Iterationselement aBook
. Wie kann ich meinen Code ohne Skripts umgestalten? Wie kann ich meine bookListArray
in .java Code wiederholen?JSP iteriert mit JSTL
<liferay-ui:search-container>
<liferay-ui:search-container-results results="${bookListArray}" />
<liferay-ui:search-container-row className="builder.model.Book" keyProperty="bookId" modelVar="aBook">
<liferay-ui:search-container-column-text property="bookName" name="book-Name" />
<liferay-ui:search-container-column-text property="bookDescription" name="description" />
<%
Author bookAuthor = AuthorLocalServiceUtil.getAuthor(aBook.getAuthorId());
%>
<liferay-ui:search-container-column-text value="<%=bookAuthor.getAuthorName() %>" name="Author" />
<liferay-ui:search-container-column-jsp path="/html/actionBook.jsp" align="right" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
Es ist mein Autor und Buchlisten:
List<Book> bookList = BookLocalServiceUtil.getBooks(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
List<Author> authorList = AuthorLocalServiceUtil.getAuthors(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
request.setAttribute("bookListArray", bookList);
request.setAttribute("authorListArray", authorList);
, wenn Sie an meinem Projekt suchen möchten, können Sie das hier tun: https://github.com/AlBoldyrev/Library/blob/master/bundles/tomcat-7.0.62/webapps/LibraryBook-portlet/WEB-INF/src/com/softwerke/BookAndAuthor.java
@Parkash Ich brauche deine Hilfe! : P – German
Wo ist bookListArray, kann auch diesen Code enthalten –
@ B'bekShakya Ich habe meine Frage aktualisiert – German