I added a line such as

<bean id="ugb" class="org.sipfoundry.sipxconfig.common.UGB"/>

to common.beans.xml

Then created a UGB class with source code of:

----------------------------------------------------------------------
package org.sipfoundry.sipxconfig.common;

public abstract class UGB {
public String m_data;
 public UGB () {
m_data = "Hello";
 }
 public String getData() {
 return m_data;
}
}
-------------------------------------------------------------

I have my web page src code UGBPage.java as:

--------------------------------------------------------------------------------------------------------
package org.sipfoundry.sipxconfig.site.admin.ugb;

import org.sipfoundry.sipxconfig.components.TapestryUtils;
import org.apache.tapestry.annotations.Bean;
import org.apache.tapestry.annotations.InitialValue;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.annotations.InjectObject;
import org.sipfoundry.sipxconfig.components.SipxBasePage;
import org.sipfoundry.sipxconfig.components.SipxValidationDelegate;
import org.apache.tapestry.event.PageEvent;
import org.sipfoundry.sipxconfig.common.UGB;

public abstract class ugbPage extends SipxBasePage {

    @Bean
    public abstract SipxValidationDelegate getValidator();

    @Persist
    @InitialValue("literal:first")
    public abstract String getTab();

    @InjectObject(value = "spring:ugb")
    public abstract UGB getUGB();

    public void pageBeginRender(PageEvent event) {
        if (!TapestryUtils.isValid(this)) {
            return;
        }
    }
}
-------------------------------------------------------------------------------------

Then try to populate textbox with ugbPage.html

bla bla
<tr jwcid="@common/FieldPanel" for="ugb:serialno"
        field="component:serialno"
        label="message:ugb.serialno">
        <td jwcid="seria...@textfield" id="ugb:serialno"
          value="spring:ugb.getData()"
          displayName="message:ugb.serialno"/>
      </tr>

As a result sipxconfig web interface is totally not working saying:

HTTP ERROR: 404

/sipxconfig/Home.html Not Found

RequestURI=/sipxconfig/Home.html

*Powered by Jetty:// <http://jetty.mortbay.org/>*


_lvnd_
(^_^)


On Mon, Dec 27, 2010 at 5:02 PM, George Niculae <[email protected]> wrote:

> On Mon, Dec 27, 2010 at 4:52 PM, Douglas Hubler <[email protected]> wrote:
> > On Mon, Dec 27, 2010 at 8:18 AM, George Niculae <[email protected]>
> wrote:
> >> On Mon, Dec 27, 2010 at 3:08 PM, Levend Sayar <[email protected]>
> wrote:
> >>> Hi, all.
> >>> I
> >>> followed
> http://wiki.sipfoundry.org/display/sipXecs/How+to+create+a+simple+page+in+sipXconfig
> >>> and added a page.
> >>> On my page, I have a textbox that must be filled with a data read from
> a usb
> >>> hardware. I have the java class that can access that hardware.
> >>> I do not know any beans, tapestry, spring etc. technology used in
> >>> sipxconfig.
> >>> So can you help me for adding my java class in sipxconfig and use it in
> >>> sipxconfig context ?
> >>
> >> Declare your class that access hardware as a spring bean (in one of
> >> the xml files used by spring to create the context, see
> >> sipxconfig-web/context/WEB-INF/web.xml, contextConfigLocation
> >> param-value), e.g. :
> >> <bean id="classThatAccessHardware"
> >> class="org.sipfoundry.sipxconfig.common.MyClass"/>
> >>
> >> then inject it in Tapestry page as:
> >>
> >>    @InjectObject("spring:classThatAccessHardware")
> >>    public abstract MyClass getMyClass();
> >>
> >> Then populate your textbox as: getMyClass().callMyMethod()
> >
> > What about if the page is not part of sipxconfig, but inside a plugin
> > jar?  Is there a way to dynamically register pages w/tapestry? or even
> > store files in separate locations?
>
> Yes, we can add a Tapestry  ISpecificationResolverDelegate to look in
> classpath for such plugin pages:
>
> http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapestry/resolver/ISpecificationResolverDelegate.html
>
> George
> _______________________________________________
> sipx-dev mailing list
> [email protected]
> List Archive: http://list.sipfoundry.org/archive/sipx-dev/
>
_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

Reply via email to