Solved

Getting values from an applet

Posted on 2003-10-23
5
217 Views
Last Modified: 2006-11-17
I have a JSP that launches a java applet (calculator). I want the applet to return a value to my JSP page (without  creating a new session) when I click a button. Is there anyway to do this?
0
Comment
Question by:Fweddie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 3

Expert Comment

by:mvoelker
ID: 9612559
The only way I can think of would probably be to load a new URL (your JSP page) and pass the desired value as an HTTP parameter:

// Construct URL with the value you would like to pass on
java.lang.whatever value;
java.net.URL myURL = new URL("http://whatever.com/yourpage.jsp?yourparameter="+value);

// Get your Applet Context and load the jsp
java.applet.Appletcontext myContext = getAppletContext();
myContext.showDocument(myURL);

Your problem here is that your JSP code is evaluated on the server - the client receives "plain" HTML, so you cannot pass values from an applet to a JSP page directly.

Hope that helps,

 - michael
0
 
LVL 3

Accepted Solution

by:
mvoelker earned 250 total points
ID: 9612573
Sorry for the typos - I've been in  a hurry...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9613148
Just do an HTTP POST via Java to another JSP/Servlet tht receives the info. See
http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
0
 
LVL 92

Expert Comment

by:objects
ID: 10215347
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept mvoelker's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

objects
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question