Beruflich Dokumente
Kultur Dokumente
Welcome to the Demicron Online Forums. If you are new to the forums community, read the
FAQ to get started.
Pass URL
Author Message
DaK888 Posted: Sat Jan 27, 2007 3:43 pm Post subject: Pass URL
I've been playing around with the java.awt texbox solution and I'm now a bit stuck.
1. Using the example in the java.awt pdf from Demicron, I can get text entered into the text boxes
to build what looks like a correct URL (as the text is displayed in the status bar correctly). However,
it apperats I'm not passing the text to the URL object. When I test the applet, a browser window
opens as it should but I get a message that the "URL is not valid and could not be loaded" (in
firefox) and the address bar is blank. So I'm assuming that the text is not being passed to the URL
object. Of course, I could be completely wrong.
2. Lets say I get this thing working correctly, is there a way to put the %20 for spaces in a URL. I
assume it's a loop that replaces spaces with the characters in a string but I'm a bit lost.
Thanks in advance!
Back to top
Kostas Zotos Posted: Sat Jan 27, 2007 6:22 pm Post subject:
Hi,
Joined: 10 Oct 2005
Posts: 154
Location: Athens (Greece)
The following suggestion requires:
OBJECTS:
1) A Java object
2) A button (optionally -as you can just press the enter key-)
3) A WF URL object (optionally -you may prefer to load the URL directly from Java object without
using the URL object..-)
CONNECTIONS:
1) From Button out-port "Button Clicked" TO Java in-port named "Submit"
Code:
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.util.StringTokenizer;
while(ST.hasMoreTokens()) {
NewURLString=NewURLString+ReplacementTxt+ST.nextToken();
if (NewURLString !="") ReplacementTxt="%20"; // The string which will
replace the "Delimiter" string.
}
System.out.println("\nNew URL String is: \n" +NewURLString);
return NewURLString;
}
To load the URL directly from Java object.. modify the code (lines in bold -located at about the end
of code- ) as follow (uncomment the one line and comment -or delete- the other -second-) :
.........
MyURL=new URL(arg);
a.showDocument(MyURL, "_blank"); // To load the URL directly -in a blank page- (without
the WF URL Object)
//sendText("URL_Text", MyURL.toString());
}catch(Exception e) {
.........
Note: Java has a string "replaceAll" method that implemented from 1.4 and newer JVM versions, so a
more compatible approach -StringTokenizer
Enumeration- has been used instead.
Kostas
Last edited by Kostas Zotos on Tue Feb 06, 2007 6:34 pm; edited 1 time in total
Back to top
DaK
Back to top
Kostas Zotos Posted: Sat Jan 27, 2007 7:33 pm Post subject:
Maybe that this was just a "piece of cake" matter.. Not exactly, depends the way you see it..
Back to top
LOL! I was just commenting on the speed and detail in which you answered my question. You're
Joined: 04 Dec 2004
Posts: 45 obviously much more experienced than I am. :D
Back to top
Kostas Zotos Posted: Tue Jan 30, 2007 2:51 pm Post subject:
Back to top
Page 1 of 1