Apex Class:
public class EmbeddedChatController {
public String selectedOption { get; set; }
public EmbeddedChatController() {
selectedOption = ApexPages.currentPage().getParameters().containsKey( 'language' ) ? ApexPages.currentPage().getParameters().get( 'language' ) : 'da';
}
public PageReference changeLanguage() {
system.debug( 'Changed Language is ' + selectedOption );
PageReference pg = new PageReference( '/apex/EmbeddedChat' );
pg.getParameters().put( 'language', selectedOption );
pg.setRedirect(true);
return pg;
}
}
Visualforce Page:
Output: