Solved

Passing parameters between pages

Posted on 1998-09-24
6
170 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now