Yesterday’s NetBeans Java RESTful Message Board Primer Tutorial had us set up a Message Board web service application in Java and built via the NetBeans IDE. Did the look of its functionality remind you of the basics of SQL DML (Data manipulation language) functionality? DML SQL statements start with the following verbs …
- SELECT
- INSERT
- UPDATE
- DELETE
… but, yes, UPDATE was missing, and today, we extend the Sample NetBeans code for this web application by writing our own UPDATE logic. We shouldn’t need any “new” web services we figure, just rearranged use of “old” web services. It’s just that UPDATE is that slightly different idea, the only “compound” DML verb, you might say, as it is a combination of SELECT (covered by a new HTML input type=text onblur event triggering the getMessage logic, whose results are analyzed to populate a message HTML input type=text that the user can change as required, to clear the way for), perhaps even a DELETE, and then an INSERT at a database position (which is a modified addMessage call). No wonder it was missed out, huh?! But if there is an optional DML verb, it would be UPDATE, and yet, such functionality is very useful to implement, and get to know more about the XML and Ajax used in the innards of the Message Board project Java and HTML code.
We’ve gathered together some source files changed for this UPDATE logic and some styling improvements, as follows …
- index.html changed this way
- MessageBoardRootResource.java changed this way
- MessageBoardResourceBean.java changed this way
- MessageHolderSingletonBean.java changed this way
Previous relevant NetBeans Java RESTful Message Board Primer Tutorial is shown below.
The NetBeans IDE is great for Java projects, and today we take a NetBeans sample project that features a RESTful Web Service component to build a rudimentary Message Board.
What functionality is at the heart of this Message Board using the RESTful Web Services as its conduit for multiple users to share data?
- add message
- delete message
- get message (via ID for example)
Of course, that is a basic design, and that is what the sample NetBeans Message Board project offers with underlying Java code. We’ve gathered together some source files as follows …
- index.html
- MessageBoardRootResource.java
- MessageBoardResourceBean.java
- MessageHolderSingletonBean.java
Perhaps you noticed the use of http://localhost:9190 for the Glassfish server today, inferring the use of port 9190, rather than the default 8080 port that is the default, but clashes with Jenkins’s default port 8080? How we got the two to live together was to change the web server HTTP port of Glassfish to be 9190, via, command …
sudo vi /Applications/NetBeans/glassfish-4.1/glassfish/domains/domain1/config/domain.xml
… and changing all (two) references to 8080 to be 9190.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.