Solved

Getting values from an applet

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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

724 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