java


Why Not Redirecting in Java Server Faces?


#ManagedBean
#SessionScoped
public class Login {
#EJB
LoginManager em;
private String username;
private String password;
private boolean rememberme;
private String errorMsg;
public Login() {
System.out.println(" In Construct " + username);
if (username == null || username.equalsIgnoreCase("")) {
System.out.println("val = " + username);
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("index.xhtml");
} catch (IOException ex) {
System.out.println("--------I/O exception------");
}
}
}
// Getters & Setters ........
}
I want that if the username is null then it will redirect me to the index.xhtml page.
It Prints the value null in console but cannot redirect me to the index.xhtml page.
Why ???

Related Links

Execute a .app file from within a java program
How to read an input file char by char using a Scanner?
Call the method of Java class which implements runnable after creating its thread object
Applet Stand alone issue
Partial compile time weaving third party jar with maven
how to store a dynamically typed text in a string in swings
How to fix this java.io.FileNotFoundException?
How to debug problems with GWT dev/hosted mode?
Converting array string to string and back in Java
Matching Uppercased Character with Lower Cased Character, Java
Parallel Boolean Expression Evaluation in Java [duplicate]
can we change the gps values of a mobile device?
I have a 3 comboboxes that represent dob. The 3 comboboxes need to be next to one another like this dd mm yyyy. Is it possible using gridbag layout?
Install different Java JDK versions on Mountain Lion
sort arraylist of complex objects alphabetically
Changing font type within strings.xml

Categories

HOME
twitter
osgi
netbeans
azure-data-factory
fluentd
dictionary
kde
office365api
google-docs
yarn
gps
win32gui
angular-ui-bootstrap
wamp
flyway4
swagger-ui
directx
gitpitch
elasticsearch-hadoop
user-input
spring-xd
nstableview
postgres-xl
zend-framework3
orchardcms
msp430
worldwind
jsdoc
viewport
swingx
grails3
ml
object-detection
orleans
lcd
p-value
numerical-methods
javacv
user-interaction
elasticsearch-ruby
replaceall
log4js-node
webkitspeechrecognition
unboundid
flink-streaming
noraui
lxd
accelerate-framework
mozilla
io-redirection
mixture-model
abstract-class
webdriver-manager
angularjs-factory
dynamic-reports
powershell-dsc
janrain
http-redirect
segment
angular2-meteor
osx-mavericks
filepicker
jquery-validate
ionicons
worker-thread
knpmenubundle
epson
word-vba-mac
httplistener
log4c
mikroc
trash
skobbler-maps
connect-by
simplewebrtc
react-native-listview
skype4py
pickadate
bluegiga
design-by-contract
photobucket
feedback
fouc
citrus-pay
dukescript
angular-leaflet-directive
sframe
ios9.1
cisco-ios
census
angular-local-storage
lustre
tween
gwidgets
dd
camanjs
tt-news
fpml
applescript-objc
onactivityresult
zend-route
hippomocks
app42
mysqltuner
jsctypes
dexterity
mylyn
chuck
automount
postgresql-performance
ohm
asyncfileupload
punbb
adk
ecl
yui-datatable
sql-server-profiler
h.323
web-application-design
getresponsestream

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App