Solved

Passing parameters between pages

Posted on 1998-09-24
6
167 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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 lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 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

22 Experts available now in Live!

Get 1:1 Help Now