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

How to convert em dash in java
Is Java's import keyword for source files or binary files?
PostgreSQL function to insert into tables.. i need it to return specific values on errors and on specific if conditions
Have to click twice to get number, Java program not working as intended
Eclipse Java Compiler Errors
JSPExpression Language reading value from bean
Switch case not returning string
Get selected cell object in datatable using different lists for each column [duplicate]
Trouble getting a Java Applet program to open in my browser
NoNodeAvailableException[None of the configured nodes are available] in Elasticsearch 5.1.2
SPRING #RestController: Passing Cookie to a Service from Every Method
Updating version numbers of modules in a multi-module Maven project where the aggregate root isn't a parent pom
How can I use dagger 2 so that I can use an abstract representation of shared preferences?
mock method is not getting called - java
Java 8 - how sum many fields into a dto?
How can I save the Open NLP parser output from Java, so that I can use it in Python?

Categories

HOME
winforms
react-virtualized
session
read-eval-print-loop
amortized-analysis
jpeg
directx
applepay
numeral.js
nstableview
openedx
visjs
java-3d
physics-engine
sylius
extjs5
zurb-foundation-6
dxf
quote
google-cloud-nl
gsmcomm
madlib
nouislider
ecto
ioio
usbserial
suricata
swisscomdev
hot-module-replacement
libraries
event-driven
objectlistview
hilbert-curve
opshub
email-templates
ensembles
pdf-reactor
core-plot
apache-fop
komodoedit
atomicity
jquery-validate
return-value
tizen-native-app
statsd
nativeapplication
feeds
font-size
parallel-data-warehouse
medium.com
instant
log4c
intrusion-detection
login-control
etsy
merge-conflict-resolution
flash-cs5
master-slave
bluemix-app-scan
netmq
jfugue
r-tree
cartesian-product
tmuxinator
tableau-online
ideamart
splash
census
npapi
rake-task
angularjs-ng-click
gui-test-framework
expected-exception
undefined-reference
hyprlinkr
intentservice
html5-notifications
oam
access-rights
runtime.exec
easy-install
jelly
kyotocabinet
bluepill
first-responder
getmessage
chrono
forums
multi-tier
mtj
eqatec
zune
w3wp

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