[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622017#action_12622017
 ] 

Leonardo Uribe commented on TOMAHAWK-1306:
------------------------------------------

The patch provided adds a dependency to:

org.apache.myfaces.renderkit.html.HtmlResponseStateManager

But this class belongs to myfaces core impl. tomahawk should work on both jsf 
ri and myfaces, so dependencies to myfaces-impl are not allowed.

on 1.2 exists a standard mechanism to detect if a request is a postback or not 
(see jsf spec), so this should be used instead.

Anyway, on jsf 1.1 a check to "javax.faces.ViewState" param could be used to 
detect a postback.

In other side look this code:

    private Object getCurrentFocusedClientId(FacesContext context, UIComponent 
component) {
        Map paramMap = context.getExternalContext().getRequestParameterMap();
        String clientId = component.getClientId(context);
        if (paramMap.containsKey(clientId)) 
        {
            //request parameter found, set submitted value
            return paramMap.get(clientId);
        } 
        else 
        {
            //see reason for this action at decodeUISelectMany
            return RendererUtils.NOTHING;
        }
    }

I don't agree to return RendererUtils.NOTHING for an clientId. This constant is 
used as other purpose (decode for UISelectOne children) and if null could be 
used it is best use it.

Could you update the patch with the suggestions proposed please?

> Focus2 postback problem
> -----------------------
>
>                 Key: TOMAHAWK-1306
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1306
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: New Component
>    Affects Versions: 1.1.7-SNAPSHOT
>         Environment: myfaces-1.2.4-SNAPSHOT
> tomahawk-sandbox12-1.1.7-SNAPSHOT
> tomahawk12-1.1.7-SNAPSHOT
> Tomcat 6.0.16
>            Reporter: Paul Rivera
>             Fix For: 1.1.7-SNAPSHOT
>
>         Attachments: focus2.HtmlFocusRenderer.patch, webapp-files.rar
>
>
> Below are the main use cases for Focus2:
> 1) if you first get to a page, the _first_ input field should be highlighted
> 2) if you post-back to a page and there is a validation-error, the
> first field with a validation error should be highlighted
> 3) if you change a value on a form (e.g. a drop-down) and this
> changing a value initiates a postback, you will want the next field
> highlighted after the field that initiated the post-back to be
> highlighted
> Here are some bugs I've found:
> I) Focus2 cannot distinguish a newly created view (user first enters the 
> webpage) from a postback (user does a submit and the same page gets loaded). 
> See the attached testValueAttr.jsp to replicate the bug.
> What happens is that if you have the following tag in your code:
> <s:focus2 value="mainForm:email"/>
> Focus2 will give focus to the component succeeding mainForm:email.  In the 
> case of testValueAttr.jsp, it is mainForm:country. In the 
> focus2.HtmlFocusRenderer.getFocusForId(), it always assumes that it is a 
> postback.
> II) Focus2.HtmlFocusRenderer does not retrieve the submitted value in its 
> decode() method.  In the current implementation, HtmlFocusRenderer calls 
> super.decode(context, component). I've checked and found out that after this 
> line, the _submittedValue of the component is still null.  _submittedValue 
> should be the clientId of the currently focused input field maintained in a 
> hidden field in your user's browser and updated by javascript for each focus 
> event (See focus2.HtmlFocusRenderer.writeUpdateFocusScript()).  Please see 
> attached testPostBack.jsp to replicate the bug.  Use case 3 fails here.
> The patch will fix both these bugs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to