Freitag, 1. Februar 2008

Create a SIP Application for Sailfin (Part 3 Webapp)

The third and last part shows how to build a simple web based administration for the user database with basic create, read, update and delete functionality. The application is modeled after the sample in http://www.netbeans.org/kb/60/web/inserts-updates-deletes.html.

View the Data
  1. Create the web page with "New->Visual Web JSF Page" and a session bean with
    "New->Visual Web JSF Session Bean".
  2. Open the visual web page editor for the created page. Then go to the "Services" tab, connect to the database and select the USERDATA table. Drag and drop it to the editor's canvas. You will see in the navigator window that a Data Provider object and a Row Set object were created.
  3. Drag and drop a table on the canvas. Select the table, right click and select "Bind to Data". Choose the userdataDataProvider which was created before and click OK. The table is now able to display data for users.
  4. Deploy the application and point your browser to localhost:8080/b2bua to view the contents of USERDATA.

Create and Delete

  1. Add a button "Add User" and a button "Save Changes".
  2. Doubleclick the "Add User" button and enter the action code from the sources.
  3. Doubleclick the "Save Changes" button and enter the action code from the sources.
  4. Select the table and open the layout editor. Add a new column and change the type of the column to "Button".
  5. Doubleclick the "Delete" button and enter the action code from the sources.
  6. Deploy the application again. You can now create and delete user data. The changes are stored in the database when you click "Save Changes".

3 Kommentare:

Unknown hat gesagt…

Hi Peter. Nice post. I have problem running the example. Hope you can help. Thanks. Everything seemed fine but registration failed. My database contains Alice@domain1. Can't understand how other web app (click to dial) got into the way. The last portion of the sailfin log as follows and the loop went on:

...
contextConfig.available /CallSetup
Initializing Sun's JavaServer Faces implementation (1.2_04-b20-p03) for context '/CallSetup'
B2B Init
Registrar Init
Registrar.init() SipFactory not initialized
Registrar.init() Timer Service not initialized
Enabling the application SIP Registrar
contextConfig.available /ClickToDial
Enabling the application Click to Dial application
contextConfig.available /b2bua
Enabling the application
...
Session created
Received register request: "Alice"(sip:Alice@domain1)
Exception allocating servlet
java.lang.NullPointerException
at clicktodial.model.ModelFacade.getPerson(ModelFacade.java:66)
at clicktodial.sip.RegistrarServlet.doRegister(RegistrarServlet.java:73)
at javax.servlet.sip.SipServlet.doRequest(SipServlet.java:64)
at javax.servlet.sip.SipServlet.service(SipServlet.java:43)
at com.ericsson.ssa.container.sim.SipServletFacade.service(SipServletFacade.java:71)
at com.ericsson.ssa.container.sim.SipServletWrapper.invokeServlet(SipServletWrapper.java:111)
at com.ericsson.ssa.container.sim.ServletDispatcher.invoke(ServletDispatcher.java:282)
at com.ericsson.ssa.container.sim.ApplicationDispatcher.invokeServletDispatchers(ApplicationDispatcher.java:269)
at com.ericsson.ssa.container.sim.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:154)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:36)
at com.ericsson.ssa.container.sim.ApplicationDispatcher.next(ApplicationDispatcher.java:438)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.sip.LocalRouteManager.next(LocalRouteManager.java:90)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.sip.DialogManager.next(DialogManager.java:435)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.sip.persistence.ReplicationManager.next(ReplicationManager.java:81)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.sip.dns.ResolverManager.next(ResolverManager.java:173)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.sip.transaction.TransactionManager.invokeCreatedOrFetchedServerTransaction(TransactionManager.java:174)
at com.ericsson.ssa.sip.transaction.TransactionManager.next(TransactionManager.java:210)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.container.OverloadProtectionManager.next(OverloadProtectionManager.java:455)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.container.GrizzlyNetworkManager.next(GrizzlyNetworkManager.java:754)
at com.ericsson.ssa.sip.LayerHelper.next(LayerHelper.java:41)
at com.ericsson.ssa.container.MessageProcessorFilter.processMessage(MessageProcessorFilter.java:291)
at com.ericsson.ssa.container.MessageProcessorFilter.execute(MessageProcessorFilter.java:241)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:78)
at com.sun.grizzly.ProtocolChainContextTask.call(ProtocolChainContextTask.java:61)
at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:179)

Peter hat gesagt…

I think the problem occurs because both click2dial and b2bua handle the REGISTER message. Does it work if you undeploy the click2dial ?

Anonym hat gesagt…

This is a nice information..really good to to know about the topic.Thanks for sharing.
web designing company