Solved

Passing parameters between pages

Posted on 1998-09-24
6
176 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Example unit tests with AngularJS 3 47
powershell md/mkdir/New-item   -Quiet 10 97
OS Selection Menu 1 47
BATCH to EXE Converter 2 37
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

861 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