Pessoal, como faço para validar um campo data???
eis aki o meu bendito código!!!
<%@ page import=“java.util., user.” %>
Cadastro de Usuario
<%
String nome = request.getParameter(“nome”);
String email = request.getParameter(“email”);
String dataNascimento = request.getParameter(“dataNascimento”);
String cargo = request.getParameter(“cargo”);
String statusFeriasStr = request.getParameter(“statusFerias”);
if ((nome == null) || (email == null) || (cargo == null) || (dataNascimento != "dd/mm/aaa") ){ => Aki tá o erro!!!!! :oops:
%>
<jsp:forward page="/inf1371/criacaoUserFalhou.jsp"/>
<% } else { %>
<jsp:forward page="/inf1371/CadastroTarefa.html"/>
<% } %>
dá um split na data e analisa cada celula do array…
no tópico anterior que você criou eu postei uma solução… essa gente não tem calma meu Deus.
Thiagão, foi mal! :oops: Como assim Split?
da documentação do java
split
public String[] split(String regex)
Splits this string around matches of the given regular expression.
This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
The string "boo:and:foo", for example, yields the following results with these expressions:
Regex Result
: { "boo", "and", "foo" }
o { "b", "", ":and:f" }
Parameters:
regex - the delimiting regular expression
Returns:
the array of strings computed by splitting this string around matches of the given regular expression
Throws:
PatternSyntaxException - if the regular expression's syntax is invalid
Since:
1.4
See Also:
Pattern
bom o split funciona assim
String data = "15/11/1981";
String[] arrayDeData = data.split("/");
for (int i = 0; i < arrayDeData.length; i++)
System.out.println("pos " + i + " valor: " + arrayDeData[i]);
o código acima vai imprimir
pos 0 valor: 15
pos 1 valor: 11
pos 2 valor: 1981
Boa tarde!!!
Cara, não sei se a solução é a melhor mais, eu estou fazendo um JavaScript, segue abaixo o código, ex:
e no formulario eu coloco a função no onSubmit:
[quote]
"
onSubmit="return validaForm()">
Data elaboração: |
" />(dd/mm/aaaa)
|
[/quote]
Qualquer dúvida em relação o código acima, me manda uma msg.
Faloooo,
Espero ter ajudado.
Ass. Tubarão - UDI / MG
O problema é que não posso usar Java Script :shock: