Solved

Getting values from an applet

Posted on 2003-10-23
5
212 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now