[Tapestry4] Tapestry求助!!! 关于@XTile组件!!!

guoxin1016 2008-01-30
下面是XTile组件的源码,我想用这个组件验证FORM表单中NAME在数据库中是否存在
如果不存在弹出信息(你所如入用户不存在)如果存在不需要提示,要用这个组件要怎么完成呢?
public abstract class XTile extends BaseComponent implements IXTile
{
    public abstract IActionListener getListener();
    public abstract String getSendName();
    public abstract String getReceiveName();
    public abstract String getErrorName();
    public abstract boolean getDisableCaching();
    // Injected
    public abstract IEngineService getService();
    public void trigger(IRequestCycle cycle)
    {
        IActionListener listener = getListener();
        if (listener == null)
            listener = getContainer().getListeners().getImplicitListener(this);
        listener.actionTriggered(this, cycle);
    }
    public Map getScriptSymbols()
    {
        ILink link = getService().getLink(false, this);
        Map result = new HashMap();
        result.put("sendFunctionName", getSendName());
        result.put("receiveFunctionName", getReceiveName());
        result.put("errorFunctionName", getErrorName());
        result.put("disableCaching", getDisableCaching() ? "true" : null);
        result.put("url", link.getURL());
        return result;
    }
}



<component-specification class="org.apache.tapestry.contrib.ajax.XTile"
    allow-body="no" allow-informal-parameters="no">
    
    <description>
        A component providing the required JavaScript to pass some information to the server
        and receive its response without reloading the page (Ajax)
    </description>
    
    <parameter name="listener">
        <description>
            The listener that will be invoked when the Javascript function with the given name is invoked.
            Any parameters passed to the send function will be available from cycle.getServiceParameters(). 
            In addition, the listener can perform cycle.setServiceParameters() to pass an array of
            strings to the JavaScript receive function. If the listener is not provided, Tapestry will
	        attempt to find a listener with the capitalized id of the component, prefixed by "do". For
	        example, jwcid="clear@XTile" would have a listener called doClear().
<!--        
				听众表示,将援用时, JavaScript函数与特定的名字引用。 
                  任何参数传递给发送功能,将可从cycle.getserviceparameters ( ) 。 
		         此外,听众可以执行cycle.setserviceparameters ( )来传送一个数组
		         弦乐团到JavaScript的接收功能。如果听众没有提供,挂毯会
				试图找到一个倾听者与资本的ID组件,带有"做" 。为
				举例来说, jwcid = "明确@ xtile "将有一名听众所谓doclear ( ) 。   
-->
        </description>
    </parameter>
    
    <parameter name="sendName" required="yes">
        <description>
            The name of the JavaScript function that the script will define to allow the application
            to send information to the server.
<!--
            名称的JavaScript函数表示,剧本将确定允许应用
            发送信息到服务器上。
 -->
        </description>
    </parameter>
    
    <parameter name="receiveName" required="yes">
        <description>
            The name of the JavaScript function that the script will call to allow the application
            to receive information from the server some time after the send function has been invoked.
<!--
		名称的JavaScript函数表示,剧本会请允许应用
		 接收信息从服务器一段时间后,发送功能已被引用。 
-->  
        </description>
    </parameter>
    
    <parameter name="errorName" default-value="null">
        <description>
            The name of the JavaScript function that the script will call to indicate that
            an error has occurred while sending the information to the server.
        </description>
    </parameter>
    
    <parameter name="disableCaching" default-value="false">
        <description>
            Some browsers cache repeated requests that have identical URLs.
            Pass 'true' to this parameter to disable caching by making the URLs unique.
<!--
		名称的JavaScript函数表示,剧本将拜会显示
            一个错误出现,而发送信息到服务器上。
-->            
        </description>
    </parameter>
    
    <component id="script" type="Script">
        <binding name="script" value="'/org/apache/tapestry/contrib/ajax/XTile.script'"/>
        <binding name="symbols" value="scriptSymbols"/>
    </component>

    <inject property="service" object="engine-service:xtile"/>
        
</component-specification>



tapestry 2008-01-31
xtile没用过,一直用tacos中的ajax组件,tacos的文档很多,自己研究一下。
Global site tag (gtag.js) - Google Analytics