In my application, the user defines a root directory. After defining the root there is a listing of files in the directory. When the file is selected there is another directory where an image with the same file name exists. I want that when selecting the file it will display the image pertaining to the file. I searched the p:graphicImage
component but I did not find a good example. I saw it using library="images"
but it only recognizes the images that are in the resources / images folder. I thought if I could change the default location of this library pointing to my images folder I could solve the problem. I wonder if this would be the best solution? Or if you help me solve this problem in another way.
At the moment the page looks like this:
<h:form>
<p:panel header="Informações dos Itens">
<h:panelGrid columns="2">
<p:outputLabel value="Diretório Raiz Origem: " for="diretorioRaizOrigem" />
<p:inputText id="diretorioRaizOrigem" value="#{questItemController.questItem.diretorioRaizOrigem}">
<p:ajax event="change" process="@this" immediate="true" />
</p:inputText>
<p:outputLabel for="itemOrigem" value="Item Origem" />
<p:autoComplete id="itemOrigem" value="#{questItemController.questItem.nomeItemOrigem}"
completeMethod="#{questItemController.listarItensDiretorioOrigem}" dropdown="true" var="bean" itemLabel="#{bean}"
itemValue="#{bean}" effect="bounce" forceSelection="true" minQueryLength="3">
<p:ajax event="itemSelect" listener="#{questItemController.itemChange()}" update="itemDestino,imagem" process="@this" />
</p:autoComplete>
<p:outputLabel value="Diretório Raiz de Destino" for="diretorioRaizDestino" />
<p:inputText id="diretorioRaizDestino" value="#{questItemController.questItem.diretorioRaizDestino}" />
<p:outputLabel value="Item Destino" for="itemDestino" />
<p:inputText id="itemDestino" value="#{questItemController.questItem.nomeItemDestino}" />
<p:graphicImage id="imagem" value="" rendered="#{questItemController.mostrarImagem}"/>
</h:panelGrid>
</p:panel>
</h:form>