{"id":36060,"date":"2018-02-09T03:01:11","date_gmt":"2018-02-08T17:01:11","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=36060"},"modified":"2018-02-09T05:14:37","modified_gmt":"2018-02-08T19:14:37","slug":"netbeans-java-restful-message-board-update-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/netbeans-java-restful-message-board-update-tutorial\/","title":{"rendered":"NetBeans Java RESTful Message Board Update Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoard_NetBeans_mm.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"NetBeans Java RESTful Message Board Update Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoard_NetBeans_mm.jpg\" title=\"NetBeans Java RESTful Message Board Update Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">NetBeans Java RESTful Message Board Update Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='NetBeans Java RESTful Message Board Primer Tutorial' href='#nbjrestmbpt'>NetBeans Java RESTful Message Board Primer Tutorial<\/a> had us set up a Message Board web service application in Java and built via the <a target=_blank title='NetBeans home page' href='https:\/\/netbeans.org\/'>NetBeans<\/a> IDE.   Did the look of its functionality remind you of the basics of SQL <a target=_blank title='Data manipulation language information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Data_manipulation_language'>DML<\/a> (Data manipulation language) functionality?  DML SQL statements start with the following verbs &#8230;<\/p>\n<ol>\n<li>SELECT<\/li>\n<li>INSERT<\/li>\n<li><b>UPDATE<\/b><\/li>\n<li>DELETE<\/li>\n<\/ol>\n<p> &#8230; but, yes, <b>UPDATE<\/b> was missing, and today, we extend the Sample NetBeans code for this web application by writing our own <b>UPDATE<\/b> logic.  We shouldn&#8217;t need any &#8220;new&#8221; web services we figure, just rearranged use of &#8220;old&#8221; web services.  It&#8217;s just that <b>UPDATE<\/b> is that slightly different idea, the only &#8220;compound&#8221; DML verb, you might say, as it is a combination of SELECT (covered by a new HTML input type=text onblur event triggering the <i>getMessage<\/i> 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 <i>addMessage<\/i> call).  No wonder it was missed out, huh?!  But if there is an optional DML verb, it would be <b>UPDATE<\/b>, 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.<\/p>\n<p>We&#8217;ve gathered together some source files changed for this <b>UPDATE<\/b> logic and some styling improvements, as follows &#8230;<\/p>\n<ul>\n<li>\n<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/index.html-GETME\">index.html<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/index.html-GETME\">this way<\/a>\n<\/li>\n<li>\n<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardRootResource.java-GETME\">MessageBoardRootResource.java<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardRootResource.java-GETME\">this way<\/a>\n<\/li>\n<li>\n<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardResourceBean.java-GETME\">MessageBoardResourceBean.java<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardResourceBean.java-GETME\">this way<\/a>\n<\/li>\n<li>\n<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageHolderSingletonBean.java-GETME\">MessageHolderSingletonBean.java<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageHolderSingletonBean.java-GETME\">this way<\/a>\n<\/li>\n<\/ul>\n<hr>\n<p id='nbjrestmbpt'>Previous relevant <a target=_blank title='NetBeans Java RESTful Message Board Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/netbeans-java-restful-message-board-primer-tutorial\/'>NetBeans Java RESTful Message Board Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoard_NetBeans.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"NetBeans Java RESTful Message Board Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoard_NetBeans.jpg\" title=\"NetBeans Java RESTful Message Board Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">NetBeans Java RESTful Message Board Primer Tutorial<\/p><\/div>\n<p>The <a target=_blank title='NetBeans home page' href='https:\/\/netbeans.org\/'>NetBeans<\/a> IDE is great for Java projects, and today we take a NetBeans sample project that features a <a target=_blank title='Representational state transfer (REST) or RESTful web services information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer'>RESTful<\/a> <a target=_blank title='Web Service information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Web_service'>Web Service<\/a> component to build a rudimentary Message Board.<\/p>\n<p>What functionality is at the heart of this Message Board using the RESTful Web Services as its conduit for multiple users to share data?<\/p>\n<ul>\n<li>add message<\/i>\n<li>delete message<\/li>\n<li>get message (via ID for example)<\/li>\n<\/ul>\n<p>Of course, that is a basic design, and that is what the sample NetBeans Message Board project offers with underlying Java code.  We&#8217;ve gathered together some source files as follows &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/index.html_GETME\">index.html<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardRootResource.java_GETME\">MessageBoardRootResource.java<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageBoardResourceBean.java_GETME\">MessageBoardResourceBean.java<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/NetBeans\/MessageBoard\/MessageHolderSingletonBean.java_GETME\">MessageHolderSingletonBean.java<\/a><\/li>\n<\/ul>\n<p>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&#8217;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 &#8230;<\/p>\n<p><code><br \/>\nsudo vi \/Applications\/NetBeans\/glassfish-4.1\/glassfish\/domains\/domain1\/config\/domain.xml<br \/>\n<\/code><\/p>\n<p> &#8230; and changing all (two) references to <i>8080<\/i> to be <i>9190<\/i>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d36033' onclick='var dv=document.getElementById(\"d36033\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/netbeans\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d36033' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d36060' onclick='var dv=document.getElementById(\"d36060\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/update\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d36060' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday&#8217;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 &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/netbeans-java-restful-message-board-update-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,12,14,37],"tags":[69,1576,496,497,576,585,644,773,833,860,997,1062,1186,1319,1341,1411,1412,1480],"class_list":["post-36060","post","type-post","status-publish","format-standard","hentry","category-ajax","category-elearning","category-event-driven-programming","category-tutorials","tag-ajax","tag-dml","tag-glassfish","tag-glassfish-web-server","tag-html","tag-ide","tag-java","tag-message-board","tag-netbeans","tag-onblur","tag-programming","tag-restful","tag-sql","tag-tutorial","tag-update","tag-web-server","tag-web-service","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/36060"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=36060"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/36060\/revisions"}],"predecessor-version":[{"id":36075,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/36060\/revisions\/36075"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=36060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=36060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=36060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}