MyEclipse: proper project structure
sonoerin - Jul 12, 2011 - 11:38 PM
Post subject: proper project structure
I do have resources/services defined for / and /office so perhaps that is why its not being caught? Here is my web.xml:
I am hoping to use a html for each rest resource and pass JSON to it for JQuery. I would greatly appreciate any help or advice anyone can offer.
support-joy - Jul 13, 2011 - 04:55 PM
sonoerin - Jul 20, 2011 - 06:49 PM
Post subject: rest project structure
I guess my question was really more about configuration. I used the wizard to setup a web service project, and I can use the created resources to actually receive a GET on the url. However, I would like to have a html page for each area so I can send/receive data back and forth. Probably I need a online tutorial that demonstrates:
/office would have an office.html that handles the request
All the REST examples I have found seem to focus on the server side, but html or something must be on the UI - how do you set that up in the project?
support-tony - Jul 25, 2011 - 08:51 AM
I'm not really sure what you're trying to do. Web services, including ReST web services, is a means of communication between two machines, using HTTP (usually). Both ends need to write code to communicate. One end has the web service and the other has a program that uses that web service to obtain data or execute some functionality. It can be two server machines communicating or a server and a client program. MyEclipse provides tools that are, essentially, the client side of the communication, in order to test your service.
An HTML page is just a front end to a web application, not a web service. If you want to display HTML pages, then a web application is appropriate, not a web service, since you are essentially communicating between a real user and the server. However, the web application, behind the HTML pages, can communicate with a web service to carry out its functionality.
But I may be misunderstanding what you're after. If my reply doesn't give you any hints, could you explain what you want, in a different way, so we can better understand?
sonoerin - Jul 25, 2011 - 02:08 PM
Post subject: clarification
My apologies for not explaining my project setup better.
What I am trying to do is when a visitor hits a page, the URL calls the resource on the server, which will do some action, and return JSON data to the HTML, where JQuery will handle it. I really don't want to use JSP, but when I try and run this, none of my html, css, or js gets applied. If I dynamically create html and return that, it does display, but again the html, css, and js are not.
Perhaps I am going down the wrong path with the HTML/JQuery approach? II just wanted something other than JSP's for this.
Support-Brian - Jul 26, 2011 - 06:49 AM
I'm assuming that you do not intend to return complete HTML from your web service calls; rather you have complete HTML + CSS + JS pages which internally make calls to the web service. The web service returns data in JSON which you use to dynamically populate part of your rendered page using jQuery. Is this correct?
I think your problem may be the fact that you're mapping all requests to your server through the REST servlet
I would recommend using a special pattern for your RESTful services, perhaps something like
Then change all the calls to the web services in your code to use this URL instead. For the client side, make sure URLs being presented and used do not use the services URL - they will then simply be directly returned by the web server and should therefore render just fine. Try a simple page with no web service calls but with JS and CSS, does that work?
All times are GMT - 6 Hours
Powered by PNphpBB2
© 2003-2004 The PNphpBB GroupCredits