Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Invoke main method from JSP page

800306Mar 27 2007 — edited Mar 28 2007
Hi all,

I have some questions about running a Java application from a JSP page. I have a class, package.Main. I want to run this, i.e. invoke it's main method, then I want to use a Bean for another class, package.Class1, and call some of the methods there. This brings me to some questions.

1) On one JSP page, can I use two Beans (jsp:useBean), one for package.Main, another for package.Class1?

2) If so, how would I run the main method of package.Main? Would I simply say
Main.main();
on my JSP page?

3) If I use a Bean with scope="session" for each of the two aforementioned classes, the classes will be 'running', so to speak, throughout the entire session, correct? In case that is vague, let me provide an example.

In my Main class, I have
private byte[] in;
which gets instantiated after the main method executes. I also have a getter method for that byte[], Main.getByteArray(), inside the Main class. Therefore, if I run Main.main() from my JSP page, and want to call Main.getByteArray() immediately afterwards, will
byte[] in
still be instantiated?

Thanks for any help,
Dan

Message was edited by:
Djaunl
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2007
Added on Mar 27 2007
3 comments
91 views