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;
        }
}

Reply via email to