What I am trying to do is defining one forward inside IF statement and one after that statement ended.
But it is not working. Please tell me why?
When I am defining only one forward after the IF statement it is working alright.
What I am expecting to happen is if variable value is 'e' then some code will run and forward it to "edit" action
If variable value is not 'e' then servlet should forward it to "failure" action
For better understanding code
This servlet is forwarding the page to "failure" action even when the String mode is 'e'.
when I have removed "forward=mapping.findForward("failure");" then error came that website has programming error or it is under maintenance.
Well, yeah. If the mode is 'e' then eventually line 19 is executed. And right after that, line 22 is executed. What is the end result?
This is Java code you have posted there. It runs in a Java runtime environment. It's Java. Don't assume that just because you have a variable named "forward" that it will be treated differently than any other variable.
ronney singh wrote:why it is showing "website has programming error"
How should we know? We don't even know what the "it" is which showing that. (You didn't TellTheDetails.) At any rate let's assume that it's correct. Then the website (yours) has a programming error. Quite possibly that's because some code threw an exception, although that's just a guess. In which case it's quite likely that there is a log which will contain a stack trace of that exception; you should look for that.