Even if you are unable to code a solution to correctness try to explain the logic behind your code. What most interviewers look for is the logic behind your solution. Try to solve some of the known programming puzzles as well. Try out the fibonacci series, recursive solutions etc etc that concentrate on core java and practice stuff that involve web development. Do your homework on
struts if the project in your organization uses it. Read up on parameters, attributes,
servlet life cycles, scopes and try to solve a few problems programtically before you take the test.
You will be able to justify your solution this way even if you cant remember what the exact code is. Good luck