質問

I'm a bit of a newbie when it comes to Java programming. I've been looking at DFP's API's. I've got some of their queries working through a command prompt on my computer.

However, I want to create a webpage which can make these calls through the click of a button. Can I link an action on a html page to a piece of Java code running. Then, I would need to retrieve the result from the J code and present it on the webpage.

Should I totally avoid the Java API for this type of thing?

役に立ちましたか?

解決

Currently, Java Server Faces (JSF), which represents the evolution of Java Server Pages (JSP), is a very good option for getting data displayed as web pages.

There are plenty advantages of using it, like: auto validation, using directly your java objects when displaying a page or receiving a request from a user, code completion (best in latest NetBeans 7.4 RC1), an abundant collection of already made professional components (see PrimeFaces) and so on.

There are much more things to say. Of course, there is no perfect technology. It always depends on what do you actually need. Based on your description, JSF might be a good candidate for you.

There are plenty of books (Core JavaServer Faces) and tutorials about this.
If you combine JSF + ObjectDB (see manual) + Apache Tomcat or Apache Tomee (in case you want to try out some other technologies part of Java Enterprise Edition (Java EE)), you'll realize how efficient can a developer be. It's just unbelievable, yet not so many know about.

Moreover, for even greater flexibility, some like to add Groovy in this combination as well. There are even more options, but I think it might be enough for you at the moment.

In conclusion, JSF with PrimeFaces might be a good start for you. Later on you can check the other things I've mentioned, but take it step by step. I hope this gave you enough info to start with.

他のヒント

In Java, you'd have a web frontend (such as jsp) that handles your requests that originate from html. (generally a controller). The controllers would in turn call into DFP using the client library.

This isn't really a dfp-sort of thing, just the typical way you'd design a simple web app.

Java is perfectly fine for this. However, without knowing your background there is possibly some further background reading required.

There are many web frameworks available for Java that would result in a web page with a button that when you click it, your Java code would be called and then return the result for display.

Many frameworks use the Model-View-Controller for decoupling the various parts of the application. I suggest you start by reading the Wikipedia article to understand the background.

Once you understand the concept, then the following tutorial Spring Web Framework will show you how to create a web application in Java using Spring.

Search for "Java Web Framework" will provide you with a list of alternatives to Spring.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top