venkatvg
venkatvg

Reputation: 13

Redirect one html page to another using perl

I have a html form

<form id="branch" method="get" action="/x/local/.../perl_code.pl">

Branch Name : <input type="text" name="textBox">

<input type="submit" value="Generate">
</form>

and in perl_code.pl I have this

use strict;
use warnings;

use CGI qw(:standard);
my $value = uc(param('textBox'));
system "perl /x/local/.../perl_CODE21.pl $value";
#other system commands that work and output the index2.html
print redirect(-url=>'http://server.com:8080/project_name/index2.html');

What I eventually want to do is, get the input from the text box in index1.html retrieve the value in perl_code and do some system commands which print out index2.htmland finally redirect it to index2.html. I have tried to manually inspect all other system commands and their output, they work. I am not able to retrieve the text value and pass it and also redirecting does not work. The browser redirects to perl_code.pl and gives a 404. I am currently running out of time. simple answers will be appreciated.

EDIT:

This is a servlet program, so also suggest any modifications to web.xml if any.

Upvotes: 1

Views: 718

Answers (1)

Amadan
Amadan

Reputation: 198314

You can't redirect after an output to stdout. Either redirect or print, not both. Check that your system call doesn't do anything to stdout; or even better, redirect its stdout to something just in case (like /dev/null).

Upvotes: 3

Related Questions