Can I define an interface in JSP?

Can I define an interface in jsp? I've tried the following at the beginning of my program:

interface iFace {
    Object reportDetail(Object arg);
}

and I get the error:

An error occurred at line: 22 in the jsp file: /printAPchecks.jsp
The member interface iFace can only be defined inside a top-level class or interface
LVL 1
MarkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrcoffee365Commented:
Works fine for me.

My guess is that you tried to define it in the middle of the jsp class -- which is not valid java.  The error message is pretty clear.

So you need to define it outside of the java class, but inside the .jsp file, like this:
<%!
interface iFace {
    Object reportDetail(Object arg);
}
%>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarkAuthor Commented:
That did the trick! Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.