Solved

Getting values from an applet

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 144
groupSum6 challenge 6 76
Requested array size exceeds VM limit 3 84
backtracking recursion  code 19 53
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

911 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

24 Experts available now in Live!

Get 1:1 Help Now