Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing parameters between pages

Posted on 1998-09-24
6
Medium Priority
?
194 Views
Last Modified: 2013-12-25
Can anybody give me an Example?

Y 'am working with Java and Y have 2 pages in the same Window of the Browser.
In Page A  Y am calling Page B with the statement showDocument like this :

showDocument(PageB)
This works fine but if Y have to pass a Parameter should Y do like this ?
showDocument(PageB?name=value)

If it`s like this how should be the code of PAGE B ( the code to receive the parameter).

Y'am not shure  if Y'am doing this rigth.
PD: Y heard something about CGI but Y don't know much ( so Y need an Example)


 
0
Comment
Question by:Pampa
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:Pampa
ID: 1828814
This is a very important question for me.
Please answer me as soon as posible.
Thanks
0
 
LVL 28

Expert Comment

by:sybe
ID: 1828815
Yes, you can pass a parameter to a page like you suggest:

http://www.somewhere.com/pageB?name=value

and if you want to pass more parameters

http://www.somewhere.com/pageB?name1=value2&name2=value2 (etc)

CGI-scripts can read the parameters passed and respond to those parameters. CGI is a general term for this functionality. CGI scripts are written in a language. Perl is a very common language.

The code for PageB depends on the language.

0
 
LVL 5

Accepted Solution

by:
b2pi earned 200 total points
ID: 1828816
showDocument(PageB?name=value) will load PageB?name=value... that much
should be clear.  If you make PageB  a cgi script, say, PageB.pl,
and call it with an exec, then the environment variable QUERYSCRIPT
will have the text of everything past the URL.  To parse it, you can
use:

#!/usr/local/bin/perl -w
use strict;

print "Content-type: text/html\n";
my($e) = $ENV{QUERYSCRIPT};

print "Arguments:\n";
$e = '' unless defined($e);
$e =~ s/^\s+|\s+$//g;
if ($e eq '') {
    print "\tNone\n";
} else {
   my($pair, $name, $value);
   foreach $pair (split(/\?/, $e)) {
       ($name, $value) = split(/=/,$pair);
       print "\t$name:\t'$value'\n";
   }
}



0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 1

Author Comment

by:Pampa
ID: 1828817
First y wolud like to thank you for your answer, but Y need you help me a bit more....

1)My Error.......
When  Y told you that the code of page A is showDocument(PageB?name=value) y should have write    that the code of Page A is showDocument(PageB?value1,value2,....valuen).

2) Y wrote the code you send me in page B, but Y didn´t have any results.
PD: Y don't know HTML,or JAVA SCRIPT only JAVA (so please be as much specific as you can)

3) In Page B y HAVE TO write the following HTML code :
     
     <APPLET CODE = "MyApplet.class" WIDTH=200,HEIGTH=200>
     <PARAM NAME =  MyInternalVariable1   VALUE = "Pepe1">
     <PARAM NAME =  MyInternalVariable2   VALUE = "Pepe2">
     </APPLET>
   
   In this case "Pepe1" and "Pepe2" are  the parameters which Y recive from page A.
   for example showDocument(PageB?"Pepe1","Pepe2")

Can Y put this HTML code inside the code that you give me?
Where should Y put this code?
Is it possible?
Y need you write again a Full example, but with all this questions answered please.
You will make me a great favour.
Thanks
Fernando
0
 
LVL 1

Author Comment

by:Pampa
ID: 1828818
Please see the coment above, and what Y need is a FULL example
Can you Help me ?

0
 
LVL 5

Expert Comment

by:b2pi
ID: 1828819
You gave me a D, and you want additional help?  Nope, doesn't parse.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

782 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