• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Corey McGlone
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
 
Thomas Paul
mister krabs
Ranch Hand
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:
 
Marilyn de Queiroz
Sheriff
Posts: 9068
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.
 
Eric Pascarello
author
Rancher
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:
http://www.coderanch.com/t/113648/HTML-JavaScript/set-applet-ID-your-html
See if that helps
Eric
 
Carl Trusiak
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
 
Maulin Vasavada
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>
 
Nicholas Turner
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic