Re: s:token usability question
Hi Costa, did you create your own token? I'm interested in know the implementations details. Could you share any code with the people in the list? Thanks in advance, On 7/6/07, Costa Basil [EMAIL PROTECTED] wrote: Hi, Lionel: Thank you for your reply. I think I am going to create my own token tag and I will extend the shale Token class to remove the attribute if the token validation passes in order to force the token to generate a new value when it gets rendered. This way I don't have to remember to reset the token. Costa - All new Yahoo! Mail - Get news delivered. Enjoy RSS feeds right on your Mail page. -- Nacho Estrada Lachós Departamento de Desarrollo Xplayat, S.L. Coso, 87, 3ºB 50001 Zaragoza Teléfono/Fax: +34 976 396561 www.xplayat.es [EMAIL PROTECTED] Este mensaje está dirigido únicamente a su destinatario y es confidencial. Si lo ha recibido por error, Xplayat, S.L. le informa de que su contenido es reservado y su lectura, copia y uso no está autorizado. Xplayat, S.L. no garantiza la confidencialidad de los mensajes transmitidos vía internet y se reserva el derecho a ejercer las acciones legales que le correspondan contra todo tercero que acceda de forma ilegítima al contenido de este mensaje y al de los ficheros contenidos en el mismo.
Re: s:token usability question
Hi, Lionel: Thank you for your reply. I think I am going to create my own token tag and I will extend the shale Token class to remove the attribute if the token validation passes in order to force the token to generate a new value when it gets rendered. This way I don't have to remember to reset the token. Costa - All new Yahoo! Mail - Get news delivered. Enjoy RSS feeds right on your Mail page.
s:token usability question
Hi, I am trying to use s:token and I have the following scenario where I think token doesn't behave as I expect (I accept I might be wrong). In a few words the token value is not refreshed as I expected. I use shale 1.0.3, myfaces 1.1.5. The org.apache.shale.component.Token class is the same in shale 1.0.3 and 1.0.4 (except comments). The page that I have contains a table and a link for deleting the rows from the table. I select a row by clicking on it then I click on the delete link to delete the row. All these actions are posts to the same page. Selecting a row is an immediate event and it bypasses any validation (in the action listener method I call getFacesContext().renderResponse() to bypass any validation). The delete link has immediate set to false. The problem is that after I delete one row, the value of the token is not refreshed, and I cannot delete any other row! I would have thought that after the validation is passed the token value should be refreshed but that is not the case. The token value is saved in the component attributes map and the attributes map is saved and restored to/from the state, and then used in Token.getToken(). One could trigger the refresh by removing the TOKEN_ATTRIBUTE_KEY attribute but I think it is a hack. Any thoughts? Thanks - All new Yahoo! Mail - Get news delivered. Enjoy RSS feeds right on your Mail page.
Re: s:token usability question
Its a problem whenever your form submits don't result in a different view being display. I had a similar problem. It is a hack but its the only way I've foundl. All my backing beans inherit from an common abstract class so I just added a utility method that gets called whenever an action navigates back to the same view. I just update the first instance of token I find the view root. I think its a fair assumption that there should only be one token. /** * Attribute key under which the shale token stores its value. */ private static final String TOKEN_ATTRIBUTE_KEY = org.apache.shale.Token.TOKEN_VALUE; /** * Resets the current shale token so future submits * are allowed. */ protected void resetToken() { UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot(); Token token = findToken(root); if (token != null) { token.getAttributes().remove(TOKEN_ATTRIBUTE_KEY); } } /** * Returns the first Token instance found in the JSF UI * tree. * @param component root of the component tree to search for token * @return first component of type [EMAIL PROTECTED] Token} */ @SuppressWarnings(unchecked) private Token findToken(UIComponent component) { ListUIComponent children = component.getChildren(); for (UIComponent child : children) { if (child instanceof Token) { return (Token) child; } Token token = findToken(child); if (token != null) { return token; } } return null; } On 7/6/07, Costa Basil [EMAIL PROTECTED] wrote: Hi, I am trying to use s:token and I have the following scenario where I think token doesn't behave as I expect (I accept I might be wrong). In a few words the token value is not refreshed as I expected. I use shale 1.0.3, myfaces 1.1.5. The org.apache.shale.component.Tokenclass is the same in shale 1.0.3 and 1.0.4 (except comments). The page that I have contains a table and a link for deleting the rows from the table. I select a row by clicking on it then I click on the delete link to delete the row. All these actions are posts to the same page. Selecting a row is an immediate event and it bypasses any validation (in the action listener method I call getFacesContext().renderResponse() to bypass any validation). The delete link has immediate set to false. The problem is that after I delete one row, the value of the token is not refreshed, and I cannot delete any other row! I would have thought that after the validation is passed the token value should be refreshed but that is not the case. The token value is saved in the component attributes map and the attributes map is saved and restored to/from the state, and then used in Token.getToken(). One could trigger the refresh by removing the TOKEN_ATTRIBUTE_KEY attribute but I think it is a hack. Any thoughts? Thanks - All new Yahoo! Mail - Get news delivered. Enjoy RSS feeds right on your Mail page.