I'm a student, and I'm trying to learn web development.
For practice, I plan to make a fictional school website and the only feature it has is register students to the school. Student provides his name and when he clicks the "register" button, his name is inserted into the database.
So I made index.html which only has a textbox and a button, and made an insert function in java that inserts student's name into the database.
But the problem is, how does the web part call the insert function written in java?
Is there a way to have java code on server side, and html/javascript/css for front-end for web UI?
I know that the practice question I put out can be done using php, but in the future, I would like to make the front-end using things like Metro UI, and server side code can get complex, so I plan to keep it in java.
You need a server capable of executing Servlets. For example, Apache Tomcat. You will need to install this on your web server to run Java servlets on the server side.
The easiest way to do this is Java Servlets. But if this Site grow up, you have to use , in my opinion, frameworks such as spring, jsf and so on.
Related
I am new to front end developing. I have so far a back-end program written in java with Eclipse that does all I want, saves the output in an object and prints it in the console (for my convenience).
My goal is to display this output information dynamically (meaning that the backend part of the program might update and send new output) in a webpage on a local server.
Hence I have "transformed" or "added" a Dynamical webpage to my Eclipse project using "Project Facets" in Eclipse Project Properties, and created an index.jsp file hosted on a tomcat server (See picture of the File organisation).
Ultimately, I want to have my index.jsp file open in my browser and when my backend program (which I assume I have to compile in an executable jar) detects changes , display those changes in the webpage. Also, I have a button on my webpage for which I would like to send information back to my backend program when it is clicked.
Should I use POST request in my backend with the URL of the index.jsp (although I don t want to display the information in a form, just regular text and images)?
or create a Javabean class in the webcontent/WEB-INF/ (if I can access and modify it dynamically from my backend) and then use that to get and set data from the jsp page?
or am I obliged to use something like Spring ?
I ve heard I should seperate backend and front end, but I don t really understand how they communicate dynamically !
Thank you for your help !
Seeing your project structure I believe you want to build a simple Java Web, you don't need to separate your front-end and back-end unless you want to build something complex.
I'm not quite sure about your experience with Java Web, but if this is your first time I suggest to learn more about Servlet because this is the fundamental in building Java Web project. After knowing how Java handle Http Request is up to you to build pure Java Web project, or using something like Spring MVC even if you want to build a separate front-end that communicate using REST API towards the back-end.
As an application to get a job I need to make a web app. I'm only familiar with Java SE so here comes my concerns. I need to make web service where at the beginning there will be authentication window, then I need to show the JSON data (probably parse it and show) as table or as list with button near to choose one of the row from the table to get to the next page where there user can choose a materials and so on.
I have data in JSON on server I need to pull it from there, then I need to show data which looks like this /materialDetails?ID=x where x is ID (it's probably HTTP or URI). Should I use Java REST? If yes I need to create a site in XML and then put java data inside? There're only a few tutorials on the internet and I can't find any good(sometimes the problem is in server, sometimes with dependencies). I was looking for information also on youtube but except https://www.youtube.com/watch?v=X36Dud8cS4Y I cant find anything useful? Could someone explain me this to make it at least a lil bit easier? Or just lead me to pick a specific framework. Thanks in advance
You could create a Dynamic Web Project with Tomcat and a MySQL Database for starters. You could use RESTEasy to create a WebService that gets data from your Database.
I don't know what exactly is expected from you, but this might be a good start. "Making a web app" is a bit like saying "I need to develop a java program", it is a bit vague !
I don't know REST but I think your application can be implemented with this technologies: HTML and Servlets/JSPs.
I would write an authentication page in HTML (one form element with 2 inputs and a button) which would pass credentials to a Java Server Page or a Servlet (they're equivalent). There I would build the table (another HTML element) thus producing a new HTML page.
P.S.: you're using JSON as a format so there's no need to learn XML.
I am required to develop a MySQL database application with some GUI requirements which are efficiently met with HTML and CSS. So I am using HTML and CSS for the GUI.
I want to use Java programming language for connection with the database and other back-end functionality.
Most importantly, I do not want to host any kind of server.
So somebody has put this idea into my head: Use java for the back-end database connection, write a web service for your code, use HTML5/CSS3 for the GUI, and JavaScript to consume the web-service.
(I hope I got it right and I am saying it right)
Please tell me if this is possible, and if this involves having some sort of a server or not. I want these three things:
Back-end in Java
GUI in HTML
No server
Is there a way?
I recently developed a whole system in Java that connected to a database and exports and imports the table content to an excel sheet. I used SWING for the user interface. the user will interact with it for authentication and file management.
Apparently the client changed the requirements, He wants everything from a Web Interface. My team leader advised to look through JSP.
What does JSP actually do?
Will I have to rewrite the User Interface in Web if I used JSP?
is there an more effective and efficient solution to do this job?
I would Appreciate a specific answer
I'm not sure what you mean by "specific answer", but here goes:
JSP is a kind of template language, based on Java, and a technology for dynamically generating HTML. It's a server side technology. Look here.
Yes, if you're going for a pure web/HTML solution, you'll need to completely rewrite the UI.
There are other frameworks for creating webapps, such as Vaadin or Play! Framework that may be "better" than JSP, but then there's a whole new API/framework to learn...
What does JSP actually do?
Will I have to rewrite the User Interface in Web if I used JSP?
is there an more effective and efficient solution to do this job?
and
I used SWING for the user interface.
and
exports and imports the table content to an excel sheet.
not, have to look at JavaFX 2
You will certainly need to rewrite the user interface if you convert to JSPs.
JSPs are essentially just a method for dynamically generating HTML (with the option to embed Java code to produce parts of the page).
It is still possible to run Swing applications from a web browser: you might want to take a look at Java Web Start. This will save you from having to do a complete rewrite.
1.) JSP is pretty much like PHP. It is server side scripting. When ever a browser request for a page (JSP page), server (mostly Tomcat or any application server which you deploy your JSP project) will generate HTML content using the JSP code. Mainly JSP consist of part HTML, JavaScipt (if you want dynamic stuff), and Java.
2.) As far as I know if you are aked to do it in JSP then you need to o all the client side work again in JSP. There you will be generating HTML UIs using Java codes. But you can use all the back end codes you used.
You may can use SWING in a Applet.
I have to make a web-service in Zend Framework for getting data from java applet.
Basically its a game built using Java Applet. I want to store result in my website's mysql database.
So I am trying to make a web service using Zend_Rest_server which will be accessed by Java applet code and I will get result data through web-service and will store them in MySql database.
Let me know if my concept is wrong. OR if I can do same task in another easier way.
I gone through some online tutorial for Zend_Rest_Sever but all are basic.
I made simple server for getting a variable value. But its not working in java application saying "Path not fond" Might be due to zend framework routing url.
Thanks in advance
Have you set the Zend_Rest_Route(s) needed?
You might want to check this out: http://mwop.net/blog/228-Building-RESTful-Services-with-Zend-Framework