Solved

Java Button Link

Posted on 1997-06-02
4
230 Views
Last Modified: 2010-04-16
How you setup a link, in java. When you click a button it will go to a hyperlink. I'm using Visual Cafe, I have my Button setup and my link setup. I used an Interaction Wizard between the two, and what I like to do is when I click this button it will go to this URL. Is there a single line of command or two, if I click this button it will go to a URL.
0
Comment
Question by:zomega
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:zomega
ID: 1221153
Since I'm here, How to you open a file and write into a file. To the server??
0
 

Author Comment

by:zomega
ID: 1221154
Edited text of question
0
 
LVL 6

Accepted Solution

by:
jpk041897 earned 150 total points
ID: 1221155
Eegarding your first question:

Use ShowDocument()

The showDocument() member is documented as follows:

void showDocument(URL url, String target)

· Requests that the browser show the specified document in a particular location either a browser window or a Netscape frame.

Options for target:
Value Document Displayed in:

· "_self" Current Frame
· "_parent" Parent Frame
· "_top" Top-most Frame
· "_blank" In a new and unnamed browser window
· "aNameofYourChoice" Creates a new browser window with the specified name. You may later display other documents in this window by using the same name as the target.

If you use "_self" as a target, the document will be loaded on the same Browser window in both IE and Netscape.

Don't be misslead by the frame part, if your document does not use frames, it will assume that the _self frame is the current page.

Regarding your second question

The simplest way tio do this is by assigning a URLConnection to a stream. A rather general eaxample would be:

String url = "http://" + getCodeBase().getHost() + "/file.dat";
DataInputStream data;
String line;

try{
try{
URL theURL = new URL("http", getCodeBase().getHost(), 80, "/rooms.dat");

data = new DataInputStream(new BufferedInputStream( theURL.openStream()));
while ((line = data.readLine()) != null) {
// whatever you want to do with the data
}
}catch( MalformedURLException e ) {
// process file not found error
}
}catch (IOException e) {
//Process I/O error
}
}

Of course, the type of stream you use will depend on exactly what it is that you want to do.

Writing to the URL is accomplished in the same fashion, just use writeLine instead of readLine.

For somewhat extensive coverage on the different types of streams you can use (and their methods) see:

http://www.mcp.com/que/et/se_java2e/18javafi.htm 


Just remember to asosiate a URLConection to whatever Stream type you decide to use.
0
 

Expert Comment

by:bill.m
ID: 1221156
If you don't care about Internet Explorer support, then
JavaScript supports that by just assigning a value to
the "location" variable (window.location).

But the aspect of LiveConnect that you'd have to use
(involving JSObject) is only supported under Netscape Nav 3.0.
(LiveConnect is the protocol for communicating between
Java and JavaScript.

I recall encountering something in Java (w/o JS) to
do it, but I can't remember at the moment.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

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 …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

752 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