Welcome to Dream.In.Code
Become a Java Expert!

Join 150,385 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,151 people online right now. Registration is fast and FREE... Join Now!




help with an if statement

 
Reply to this topicStart new topic

help with an if statement, Very new to java and need some help

jjsaw5
24 Jan, 2008 - 05:39 AM
Post #1

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,651



Thanked: 8 times
Dream Kudos: 125
My Contributions
Hello,

I need some help creating an if statement that will call this date validation function. LInk

there are two feild that i need to use this function on fromDate and toDate.

I know that i need to call the method with this

if (!Validator.isValid(fromDate) || !Validator.isValid(toDate)) {

and I need to to check the date and if its not a valid date, to kick the users to an error page.

can anyone help me figure out how to do this please.


Thank you smile.gif
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Help With An If Statement
24 Jan, 2008 - 06:42 AM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,103



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
What is the questions?
Assuming that isValid returns a proper boolean the code you have will work fine.
User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: Help With An If Statement
24 Jan, 2008 - 06:58 AM
Post #3

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,651



Thanked: 8 times
Dream Kudos: 125
My Contributions
QUOTE(William_Wilson @ 24 Jan, 2008 - 07:42 AM) *

What is the questions?
Assuming that isValid returns a proper boolean the code you have will work fine.



ok so i would just need an else clause if the date was invalid right?

Something like this...

CODE
if (!Validator.isValid(fromDate) || !Validator.isValid(toDate))        

else {

LOG.fine("From Date and To Date are not the correct format:" + fromDate + ", " + toDate);

return mapping.findForward(NOT_FOUND_FORWARD);

}


This post has been edited by jjsaw5: 24 Jan, 2008 - 06:58 AM
User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: Help With An If Statement
24 Jan, 2008 - 07:03 AM
Post #4

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,651



Thanked: 8 times
Dream Kudos: 125
My Contributions
I figured out what i need to do.

I just needed get rid of the else, i don't need that.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:44PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month