Solved

Getting values from an applet

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
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 tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

813 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

17 Experts available now in Live!

Get 1:1 Help Now