You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tim Pyle <tp...@portiva.com> on 2005/04/11 16:47:50 UTC

JSF Forward -- Off Subject

I do not think this really is myFaces specific or not as i have not
tried with Sun's RI. But I think it is more just my lack of JSF
navigation knowledge.  I am attempting to build a tag that can check for
certain data at the begining of page. This tag takes the attributes,
var, and url. What it is supposed to do is check the session for valid
data in the "var" attribute. And if the data is not there or valid, it
should then forward the request off to the given "url". Can someone look
at the code and tell me where I am messing up, or if I am going down the
wrong path altogether. Any help is greatly appreciated.

Current strUrl is "/buPage.jsp"

		if (session.getAttribute(strVar) == null) {
			Logger.debugln("viewRoot before: " +
context.getViewRoot().getViewId());
			UIViewRoot viewRoot =
context.getApplication().getViewHandler().createView(context,strUrl);
			viewRoot.setViewId(strUrl);
			context.setViewRoot(viewRoot);
			Logger.debugln("viewRoot after : " +
context.getViewRoot().getViewId());
			context.renderResponse();
		}


Tim


Re: JSF Forward -- Off Subject

Posted by Heath Borders <he...@gmail.com>.
Usually, I do FacesContext.getCurrentInstance
().getExternalContext().sendRedirect(url);
 I realize that this will require an additional client roundtrip, but it 
keeps everything nice in terms of JSF.

 On Apr 11, 2005 9:47 AM, Tim Pyle <tp...@portiva.com> wrote: 
> 
> I do not think this really is myFaces specific or not as i have not
> tried with Sun's RI. But I think it is more just my lack of JSF
> navigation knowledge. I am attempting to build a tag that can check for
> certain data at the begining of page. This tag takes the attributes,
> var, and url. What it is supposed to do is check the session for valid
> data in the "var" attribute. And if the data is not there or valid, it
> should then forward the request off to the given "url". Can someone look
> at the code and tell me where I am messing up, or if I am going down the
> wrong path altogether. Any help is greatly appreciated.
> 
> Current strUrl is "/buPage.jsp"
> 
> if (session.getAttribute(strVar) == null) {
> Logger.debugln("viewRoot before: " +
> context.getViewRoot().getViewId());
> UIViewRoot viewRoot =
> context.getApplication().getViewHandler().createView(context,strUrl);
> viewRoot.setViewId(strUrl);
> context.setViewRoot(viewRoot);
> Logger.debugln("viewRoot after : " +
> context.getViewRoot().getViewId());
> context.renderResponse();
> }
> 
> 
> Tim
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org