One of the outcomes of my work on my first iOS app is my Github repository Html5StarterAppWithSwift which is an Xcode project template for creating Html5/iOS apps, or maybe we can call it “native Html5 iOS apps”… hmm what do I mean? What I mean is, it’s an Xcode project template, that can help you create native iOS apps such that all of the app’s UI is powered by Html/Javascript, while it makes use of native iOS code (Swift) for scheduling local notifications, storing data (Core Data) etc. In this post, I will talk about writing Java web apps, focusing on separating front-end and backend components.
p.s. if you would like to know about Html5StarterAppWithSwift, you can have a read of this post.
So what is this post about?
p.s. I am going to describe Java web apps written with an MVC framework in a very simple way.
Writing Java web apps
- A set of Java classes that facilitate storage and retrieval of data, typically from the database
- A set of Java classes that facilitate communication between the UI components and the database.
- The UI which is typically created using HTML/CSS and Javascript
Java web app walkthrough
- The user will open the web app in the browser by entering it’s url in the browser
- The url will open a web page HTML based UI which will show a registration form to the user where the user can enter his/her details. The registration form is HTML based and it maybe styled using CSS and depending on the web app’s needs, there maybe some Javascript being used to handle events like form submission etc.
- The user enters all the details and then clicks register, the register event will invoke a Java Servlet which will save the user’s details.
- The Java Servlet will get all the user details from the HTML based registration form and then save it to the database.
- Once the data is successfully saved to the database, the Servlet will send a message back to the UI that the details have been successfully saved. The UI can then show an alert or display a message or whatever it needs to do with that info to notify the user their details are saved.
- The next time if the user wants to access their details, the Servlet can simply retrieve the user details from the database and send it to the UI.
What’s next?
In this post, we talked about writing Java web apps. In part 2 of this post, I explain why the process of building an iOS app by using an Xcode project template such as this, is very similar to the Java web app walkthrough mentioned above. To me it is pretty much the same as above, the only thing that is different is instead of Java, we use Swift for the iOS app. Ok, how about you have a read of it for yourself, here’s part 2.
As usual, if you find any of my posts useful support me by buying or even trying one of my apps on the App Store.
Also, if you can leave a review on the App Store or Google Play Store, that would help too.
0 Comments