Skip to content
Snippets Groups Projects
Unverified Commit d73aa431 authored by Wilson de Farias's avatar Wilson de Farias
Browse files

Adiciona formulário e tratamento para hash de mensagem

parent bb178e4a
No related branches found
No related tags found
No related merge requests found
package br.ufrn.imd.web2.encryption.jsf;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named
@RequestScoped
public class SomeBean {
public static final String HASH_FORM_XHTML = "/hash/form.xhtml";
private String originalMessage;
private String hashedMessage;
public String getOriginalMessage() {
return originalMessage;
}
public void setOriginalMessage(String originalMessage) {
this.originalMessage = originalMessage;
}
public String hashnifyMessage() {
this.setHashedMessage(String.valueOf(originalMessage.hashCode()));
return form();
}
public String form() {
return "/hash/form.xhtml";
return HASH_FORM_XHTML;
}
public String getHashedMessage() {
return hashedMessage;
}
public void setHashedMessage(String hashedMessage) {
this.hashedMessage = hashedMessage;
}
}
<ui:composition template="/WEB-INF/template/layout.xhtml"
xmlns:a ="http://xmlns.jcp.org/jsf/passthrough"
xmlns:c ="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:f ="http://xmlns.jcp.org/jsf/core"
xmlns:h ="http://xmlns.jcp.org/jsf/html"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns="http://www.w3.org/1999/xhtml">
......@@ -13,9 +13,15 @@
<h:form>
<h:outputLabel for="mensagem">Mensagem:</h:outputLabel>
<h:inputText id="mensagem" value=""></h:inputText>
<h:inputText id="mensagem" value="#{someBean.originalMessage}"></h:inputText>
<h:commandButton type="submit" value="Enviar"/>
<h:commandButton action="#{someBean.form}" type="submit" value="Enviar"/>
<c:if test="#{!someBean.hashedMessage.isEmpty}">
<h:outputLabel for="hashedMessage">Mensagem:</h:outputLabel>
<h:outputText id="hashedMessage" value="#{someBean.hashedMessage}"></h:outputText>
</c:if>
</h:form>
</ui:define>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment