izpack 同一个页面,触发显示不同界面

怎么实现在同一个页面,根据不同的触发显示不同的界面?

譬如说:有两个radio button,根据不同的选项,显示不同的界面。

解决方案:定义condition,并设置radio button的revalidate="yes".

1)在install.xml中添加variable和condition

<variables>
    	<variable name="show.differ.input" value="show1"/>
    </variables>
    <conditions>
    	<condition id="showField1" type="variable">
    		<name>show.differ.input</name>
    		<value>show1</value>
    	</condition>
    	<condition id="showField2" type="variable">
    		<name>show.differ.input</name>
    		<value>show2</value>
    	</condition>
    </conditions>

 2)在userinput.xml中

 <panel id="panel1">
    <field type="radio" variable="show.differ.input">
        	<description txt="Show different field demo"/>
		<spec>
				<choice txt="Show Field 1" revalidate="yes" value="show1"  />        
				<choice txt="Show Field 2" revalidate="yes" value="show2"/>          
		</spec>
     	</field> 
    <field type="text" variable="aaa" conditionid="showField1">
      <spec txt="Field 1:" size="25" set=""/>
    </field>
    <field type="text" variable="bbb" conditionid="showField2">
      <spec txt="Field 2:"  size="25" set=""/>
    </field>
  </panel>

猜你喜欢

转载自luhantu.iteye.com/blog/2050671