Hi Michael,

for actions used in partial rendering you should always return null!
I the action returns a string than a full reload is made!
I suggest using actionListener for partial actions.

When rendering partially only the requested subview (plus the action
component if outside) is processed on the server.

In your example you request reload of box2, which means the content of
box2 is processed and stored in the model.
In the action string2 is set to string1 but string1 was not processed
so it is still null here.

Have you in helmuts example really changed the value of
renderedPartially to the suggested panel arround both boxes?


Regards,
    Volker




2010/4/12  <[email protected]>:
> Hello,
>
> I'm trying to execute an action and partial rendering the result in an
> <tx:in> field. The tx:button which calls the action and the tx:in elements
> are in different forms. For some reasons after the new value is set to the
> underlaying value of the tx:in field the setter of this value is called
> from somewhere and overwrites the new value with an empty string.  But I
> want to have the value I set with my action1 method in the field instead
> an empty string. Can some one tell me what I'm doing wrong?
>
> Thanks a lot Michael
>
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
> <%@ taglib uri="http://myfaces.apache.org/tobago/component"; prefix="tc" %>
> <%@ taglib uri="http://myfaces.apache.org/tobago/extension"; prefix="tx" %>
> <f:view locale="de">
>        <tc:page width="1280" id="page">
>
>        <f:facet name="layout">
>                <tc:gridLayout rows="fixed;fixed;1*" columns="fixed"/>
>        </f:facet>
>
>    <tc:form id="form1">
>        <tc:box label="box1" id="box1">
>                <f:facet name="layout">
>                        <tc:gridLayout rows="fixed;fixed;1*" columns="fixed"/>
>                </f:facet>
>            <tc:cell>
>                <tx:in value="#{testController.string1}" label="string1" />
>            </tc:cell>
>            <tc:cell>
>                <tc:button action="#{testController.action1}" label="submit1">
>                        <tc:attribute name="renderedPartially" 
> value=":page:form2:box2"/>
>                </tc:button>
>            </tc:cell>
>            <tc:cell/>
>        </tc:box>
>        </tc:form>
>
>    <tc:form id="form2">
>        <tc:box label="box2" id="box2">
>                <f:facet name="layout">
>                        <tc:gridLayout rows="fixed;fixed;1*" columns="fixed"/>
>                </f:facet>
>            <tc:cell id="cell2">
>                <tx:in value="#{testController.string2}" label="string2"  />
>            </tc:cell>
>            <tc:cell/>
>        </tc:box>
>        </tc:form>
>        <tc:cell>
>        </tc:cell>
> </tc:page>
> </f:view>
>
>
> package test;
>
> import java.io.File;
> import java.util.Date;
>
> import javax.faces.event.ValueChangeEvent;
>
> import org.apache.commons.fileupload.FileItem;
> import org.apache.myfaces.tobago.model.SelectItem;
>
>
> public class TestController {
>
>        private String string1;
>        private String string2;
>
>        // access methods
>        public String action1()  {
>
>                string2 = string1;
>
>                return "success";
>        }
>
>        // Getters and Setters
>        public String getString1() {
>                return string1;
>        }
>        public void setString1(String string1) {
>                this.string1 = string1;
>        }
>        public String getString2() {
>                return string2;
>        }
>        public void setString2(String string2) {
>                this.string2 = string2;
>        }
> }
>
>



-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de

Reply via email to