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

Want to use Command Line commands in Java Program? [duplicate]
Open a new window in Eclipse Plugin
Maven cucumber reporting failure - Java.io.FilenotFound exception cucumber.json
Autowiring based on generic types in Spring. How does it work?
Exception Logging with Spring
“ConnectException: Connection timed out” even if the URL works in the browser
FloatBuffer throwing exception? How can I fix this?
find two consecutive words/strings with regex expression java (including punctuation)
Java EE: Interceptor and Singleton, how to intercept before Singleton con check
What does the question mark in java mean?
How can i put BorderLayout in CardLayout?
Redrawing a new JFrame in an existing one?
onItemClickListener in ListView not working
android: error while running an app on eclipse emulator-“unfortunately, edvi(project name) has stopped”
Can I Layer JavaFX Controls?
How to merge multiple tables with similar names in MySQL from different Databases

Categories

HOME
testing
image-processing
mediawiki
ngrx
fme
relay
react-redux
maven-3
c#-2.0
blueprintjs
django-imagekit
gitpitch
node-pdfkit
apache-cayenne
circular-dependency
leiningen
fortumo
apache-metamodel
nhibernate-envers
swingx
plunker
amazonsellercentral
riot.js
dcevm
captiveportal
angular2-aot
underflow
spark-jobserver
django-storage
jaxb2
c++-amp
procdump
javascriptcore
xquery-3.0
catch-all
hexo
gesture
dynamics-crm-2013
withings
abstract-class
android-fingerprint-api
ansible-playbook
leading-zero
elasticsearch-plugin
lumberjack
avro4s
checkboxlist
sencha-touch-2.3
auto-update
xml-documentation
dds
csound
crypt
memory-alignment
angular-strap
word-vba-mac
spring-android
sts-springsourcetoolsuite
merge-conflict-resolution
bstr
fputcsv
browser-link
feedback
computer-algebra-systems
ideamart
fluid-dynamics
cisco-ios
notify
c++03
sorl-thumbnail
gui-test-framework
phalanger
javafx-webengine
comexception
rtmfp
bulkloader
rabl
ocunit
cassini-dev
pvrtc
broken-links
manchester-syntax
dotnethighcharts
external-accessory
infobox
psi
xmemcached
yetanotherforum
fluent-interface
gallio
fixed-width
memory-size
eqatec
aquaticprime
spec#
paul-graham

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