Vertical < hr > (Linea vertical)

Una linea en horizontal se hace con < hr >, pero para hacer una linea en vertical se puede usar:

< style="display:inline;border-collapse:collapse;border:0"><><>< style="padding:0">< src="http://www.blogger.com/transparent.gif" width="2" height="600" style="background:black">
< /td>< /tr>< /tbody>< /table>

By Miguel Ruiz on lunes, 22 de noviembre de 2010 | A comment?

Validar un input en JSF

Este es un ejemplo de como validar que un email es correcto. Aunque sólo se mira si se ha escrito el símbolo @, se pueden utilizar también expresiones regulares.

En la página xhtml o jspx:


< div id="loginForm">
< h:form id="registerInput">
< h:panelGrid width="375px" bgcolor="#e6edfd" columns="2" border="0">
< h:commandLink action="#{usuario.haceClickEnLogin}">Login/Registro< /h:commandLink>
< /h:panelGrid>
< h:message id="errorEmail" for="error" errorStyle="color:red"/ >
< /h:form>
< /div>



En el BackBean (Sabiendo que tenemos un atributo String email; con su get y set):

public void validaEmail(FacesContext context,
UIComponent toValidate,
Object value) {
String emailIntroducido = (String) value;

if (!emailIntroducido.contains("@")) {
FacesMessage message = new FacesMessage();

message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("Email no valido");
message.setDetail("Email no valido");
context.addMessage("registerInput:error", message);
}

}

By Miguel Ruiz on sábado, 6 de noviembre de 2010 | | A comment?

Mandar parámetros por JSF

Ejemplo de cómo mandar parámetros de un JSF (xhtml) a un BackBean:



En la página xhtml o jspx:

< h:commandLink actionListener="#{inventoryList.filtrar}" >
< f:attribute name="filtro" value="#{inventoryList.filtro}"/>
< span>Filtrar< /span>
< /h:commandLink>

En el back bean (invertoryList):

public void filtrar(ActionEvent event) {
String filtro = (String) event.getComponent().getAttributes().get("filtro");
}

By Miguel Ruiz | | A comment?