jsf 2 - How to throw 404 from bean in jsf -



jsf 2 - How to throw 404 from bean in jsf -

i need throw 404 , take visitor specific page. trying next code:

facescontext facescontext = facescontext.getcurrentinstance(); externalcontext externalcontext = facescontext.getexternalcontext(); externalcontext.setresponsestatus(httpservletresponse.sc_not_found); externalcontext.setresponseheader(common.location, "browse_by_category.xhtml?category=category_all"); facescontext.responsecomplete();

404 happens redirection browse_by_category.xhtml page not happen. help appreciated.

according comment please seek this:

facescontext facescontext = facescontext.getcurrentinstance(); externalcontext externalcontext = facescontext.getexternalcontext(); externalcontext.setresponsestatus(httpservletresponse.sc_not_found); //externalcontext.setresponseheader(common.location, "browse_by_category.xhtml?category=category_all"); externalcontext.dispatch("browse_by_category.xhtml"); facescontext.responsecomplete();

jsf-2 http-response-codes

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -