I now have the page doing the forward... however, on the page that it is
forwarding to, I have to hit the submit button twice for the page to
submit the way it is supposed to. I have noticed that the id of the
forwarding view gets appended to the form id of the page that gets
called. I will try and explain :)
so now the form in the new page is like this <form
id="Page1Id:Page2Id:formId">
When I hit submit the first time, the page changes to the correct <form
id="Page2Id:formId">
Code:
UIViewRoot root = vh.createView(context, viewUrl);
root.setViewId(viewUrl);
context.setViewRoot(root);
Logger.debugln("viewUrl: " + viewUrl);
pageContext.getServletContext().getRequestDispatcher(viewUrl).forward(request,response);
I have also tried the last line with :
context.getExternalContext().dispatch(viewUrl); Same results. Only way I
can get it to work remotely correct is if I do a redirect rather than
forward.
Does this make any sense to anyone?
Tim
On Tue, 2005-04-12 at 13:47, Heath Borders wrote:
> You have to set the current viewId on the UIViewRoot first, but then
> yes, you could do that.
>
> On Apr 12, 2005 1:44 PM, Virtudazo, Dennis (Exchange)
> <[EMAIL PROTECTED]> wrote:
> Why not just do a simple forward?
>
> getServletContext().getRequestDispatcher(forwardUrl).forward(req,
> res);
>
> -----Original Message-----
> From: Tim Pyle [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 11, 2005 10:48 AM
> To: [email protected]
> Subject: 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
>
>
> ***********************************************************************
> Bear Stearns is not responsible for any recommendation,
> solicitation,
> offer or agreement or any information about any transaction,
> customer
> account or account activity contained in this communication.
>
> ***********************************************************************
>
>
>
>
> --
> -Heath Borders-Wing
> [EMAIL PROTECTED]