Added FrontController

This commit is contained in:
Moser Benjamin 2019-02-27 23:55:13 +01:00
parent 07dc0d0ff4
commit 4e95af08a2
7 changed files with 61 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
doc/pse.docx Normal file

Binary file not shown.

BIN
doc/~$pse.docx Normal file

Binary file not shown.

Binary file not shown.

View File

@ -345,6 +345,67 @@ public static DocumentDTO toDTO(Document document){};
\begin{itemize}
\item Java Server Faces (bei Java Server Faces enthält das File zwar keinen Java Code, interagiert aber direkt mit Java Code einer Backing Bean)
\end{itemize}
\subsubsection{Anwendung im Projekt}
JavaServer Faces: mächtiges Framework, wo das MVC Pattern verwendet wird. Auf der einen Seite
stehen die reinen Views (XHTML Seiten) und auf der anderen Seite Java Beans (Java Klassen), die als
View Helper fungieren können. Beispiel: layered/MVC-JSF
Primefaces ist eine konkrete Implementierung der JavaServer Faces (siehe POM.XML).
\begin{minted}[linenos,breaklines=true]{xml}
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
template="communityTemplate.xhtml">
<ui:define name="communityContent">
<h1>#{msg.document_manage_title}</h1>
<f:metadata>
<f:viewAction action="#{documentListController.loadDocumentsFromCommunity()}" />
</f:metadata>
<h:form id="doclistform">
<p:commandButton value="Refresh list" actionListener="#{documentListController.loadDocumentsFromCommunity()}" update="@form doclistform"></p:commandButton>
<p:dataTable id="doclisttable" value="#{documentListController.communityDocuments}" var="docs">
<p:column class="documenttimecolumn" headerText="#{msg.document_uploaded}">#{docs.createdTimestamp}</p:column>
<p:column class="documenttimecolumn" headerText="#{msg.label_userid}">#{docs.user.userId}</p:column>
<p:column headerText="#{msg.label_filename}">#{docs.filename}</p:column>
<p:column headerText="" class="documentbuttoncolumn">
<p:commandButton value="#{msg.button_download}" ajax="false"
onclick="PrimeFaces.monitorDownload(start, stop);">
<p:fileDownload value="#{documentController.downloadDocument(docs.id)}"/>
</p:commandButton>
</p:column>
<p:column headerText="" class="documentbuttoncolumn">
<p:commandButton id="btnDel" value="#{msg.button_delete}"
actionListener="#{documentController.removeDocument(docs.id)}"
update="@form doclistform">
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<h:form id="formdocupload" enctype="multipart/form-data">
<p:fileUpload id="fileupload"
dragDropSupport="false"
update="@form doclistform"
fileUploadListener="#{documentController.uploadDocument}"
allowTypes="/(\.|\/)(pdf|jpe?g|docx)$/" sizeLimit="5000000"
mode="advanced" label="Add document (.pdf .jpg .docx)">
</p:fileUpload>
</h:form>
<p:messages id="feedbackBox" severity="info,error" showDetail="true" showSummary="false">
<p:autoUpdate/>
</p:messages>
</ui:define>
</ui:composition>
\end{minted}
\subsubsection{Nenne die Konsequenzen der Anwendung}
\begin{itemize}
\item es muss nur EIN (Front) Controller konfiguriert werden