• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Is it possible to obtain URL Encoded Params in an Applet?

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply put, is it possible for a page (let's call it myAppletPage.html) to have URL Encoded Parameters and get them into an Applet?
I'd like to link to a page like this:

And have those two parameters and their values accessible by the Applet? Is there a way to do that?
Thanks,
Corey
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The parameters are on the server and the applet is on the client. You would need to have a cgi program build the applet html page passing the parameters in as part of the applet tag.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Thomas. I was afraid that was going to be the answer I'd get. :roll:
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use applet-servlet communication rather than trying to use applet-html communication.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript talking to the parameter
look at this info:
if you do not know:
with JavaScript you can get the location by
var TheLoc = document.location.href;
To talk you can use this:
https://coderanch.com/t/113648/HTML-JavaScript/set-applet-ID-your-html
See if that helps
Eric
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, use JavaScript to set those values into Cookies on Page 1, then when Page 2 is loading, read the values off the cookies and pass them into the applet. You use JSObject for the communications between the Applet and JavaScript. Info on Cookies from JavaScript. http://www.webreference.com/js/column8/property.html
Of course this is simple if you are using JSPs or Servlets
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
if i were there, i would try following,
1. embed the applet tag in the JSP instead the HTML and then in the JSP i would retrieve ALL the query string parameters via request.getParameterNames() and then iterating the Enumeration to get values.
2. then build the PARAM tags with those parameter names and values in JSP.
e.g.
StringBuffer sb = new StringBuffer();
String paramName= null;
while ( enum.hasMoreElements() ) {
paramName = (String)enum.nextElement();
sb.append("<PARAM NAME='"+paramName+"' VALUE='"+request.getParameter(paramName)+"'>");
}
3. retrieve these parameters in the applet.
here, in the applet we don't have getParameters() or getParameterNames() or something like that which will get ALL the parameters. we have to do it one by one and "know" the names of each parameter, which might be a problem , right?
regards
maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry,
i forgot to mention that after the 2nd step,
we would have to do sb.toString() to embed the PARAM tags in the APPLET tag like,
<applet ...>
<%=sb.toString()%>
</applet>
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and actually if you numbered them numerically you could just do a loop till the result is null and that solves the last problem.
now he can routinely hack web sites
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic