call class function in jsp

Hi pretty new to jsp/java but hopefully someone will be so kind as to help.

I currently have a jsp file that imports in various class files from within a jar file ie

<%@ page import="java.util.*" %>
<%@ page import="com.webapp.loc.*" %>

Unfortunately I am unable to edit the class files due to licensing but would like to call one of the functions within a class file independtly, how would I go about doing this ?

The problem I have is that within the class file the function I want to run is within an if statement which again I have no control over so ideally would like to call the function independtly from the jsp page, the lis I would like to use is :

 write(Menu.midLine(env, page.getNodeMenu()));

The above ius stored in a class file called : pageR.class   this also import other class file to run the menu.midLevel etc

Thanks,  off now to read up on jsp/java.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Can you provide some more detail please?

What is the method that you want to call?  What is the method with the "if" statement?
kan3Author Commented:
Need to ignore the if statement because I have no control of the value that is passed, basically I want to run :  

write(Menu.midLine(env, page.getNodeMenu()));

within my jsp rather than within the class file

Like I say I am a newbie to jsp/java so apologies if I am not making sense.  Usually work with asp and php.

If I got it right, you want to change the logic of compiled class, right? It seems to be impossible, you need to change the souce code and recompile it.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.


Is the write() method providing output that should be included in the HTML?

If so you could either do:

    out.print(Menu.midLine(env, page.getNodeMenu()));


<%= Menu.midLine(env, page.getNodeMenu())) %>

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
kan3Author Commented:
I could do that but then I would be breaking the license of the web app.

I just want to run the line :

write(Menu.midLine(env, page.getNodeMenu()));

from within my jsp page and that will use the class files.

Currently the line is within a class file but is within an if statement so for my requirements I can't use therefore I would just like to add this line directly in the jsp page which will run the calls from the class files, make sense ??

privatee from within class file pageR.class

private void pageH(Env env)
                    write(Menu.midLine(env, page.getNodeMenu()));

I can't control onlyUse but inside want to run the line within this.

Thanks for help.


You'll have a problem if write is not public.
Ignore my last comment.  It depends on what write() does.  Let us know what happens when you try the code from my earlier comment.
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

From novice to tech pro — start learning today.