+ Start a Discussion

PageReference not working at all

This is my simple page and controller but it does not work at all........every time i click the submit button it refreshes the current page
<apex:page controller="MyController" tabStyle="Contact">
<apex:form >
  <apex:commandButton action="{!submit}" value="Export" id="BtnExport"/>              
public class MyController { 
   public PageReference submit() {
        PageReference secondPage= new PageReference('www.google.com');
        return secondPage;
amar joshiamar joshi
PageReference secondPage= new PageReference('http://www.google.com');

try this its definitely works

no it doesn`t work...not even commandlink works with an ordinary url........why would this be?
amar joshiamar joshi
i have just copy and paste your code
and its working while changing http://www.google.com

i m wondering if u have another code with this so u may be stuck with other issues

please put all code

Message Edited by amar joshi on 09-30-2008 02:53 PM
Actually you were right........i had a problem in my code that gave no error but was incorrect and caused the function not to work.
I'm having a similar problem, what was the code issue?