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

JTable -> Excel -> JTable - issue with extension
How can I parse json using Java (android) [duplicate]
Importing previously used strings into a new method
Java and JSR-223 to run Python (or Ruby) code on a Coldfusion server
How to prevent a page break between a paragraph and the following table
Java Servlet button not working anywhere, but on my pc
getting values and objects from jsp to Spring MVC controller and DB
How to make a console-based menu out of an array?
I need to create an array list in java i think?
Having issue launching Eclipse on Feodra 24
Save JTextPane contents(Image ,table) in a file
Java regex don't count all matches in a given file
JScrollPane doesn't belong to JTable
Searching for Strings in a 2D Char Array without any Methods
Failed to start bean 'documentationPluginsBootstrapper' in spring data rest
Store a user defined object in a cell in MS Excel using Apache POI

Categories

HOME
mediawiki
iterator
jira
react-redux
spring-jdbc
amortized-analysis
jpeg
ezpublish
esper
facebook-messenger-bot
cloudkit
correlation
google-cloud-spanner
moonmail
phaser
zebra-printers
dosgi
telephony
django-admin
sms-gateway
openedx
ml
tokenize
kvc
javacv
su
rst2pdf
tasklet
file-rename
phonegap
xquery-3.0
google-sites-2016
calibre
grails-3.1
stringtemplate
protovis
phpfreechat
gammu
plsql-psp
io-redirection
bitbucket-pipelines
x11-forwarding
az-application-insights
azure-ml
broadcastreceiver
hp-ux
estimote
no-www
menuitem
revapi
dandelion
tizen-native-app
tropo
elgg
colorama
csound
slickedit
nodebb
memory-alignment
cubes
skobbler-maps
transmitfile
multiple-regression
testng-dataprovider
hover-over
prerequisites
fouc
nsight
notify
dd
jscript.net
gulp-less
html-helper
project-planning
dealloc
didselectrowatindexpath
concurrent-collections
multiprocessor
web2py-modules
easy-install
excel-2003
android-screen-support
sharp-repository
ember-app-kit
robotics-studio
angularjs-controller
datawindow
objective-c-2.0
qtkit
windows-phone-7.1.1
external-accessory
blackberry-playbook
inotifycollectionchanged
android-sdk-2.1
cxxtest
audio-capture
iweb
exchange-server-2003
ti-dsp





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