Reputation:
I'm making a sort of Webserver that enables a user to give .jow file and then when a web browser ask for that file a view will be generated and shown.
Now my question is:
In what do I need to generate the view?
Do I need to use html, css, or javascript?
Do I need to write a part of special applets?
Thanks in advance!
Upvotes: 0
Views: 183
Reputation: 8943
No matter what you do, the "view" will have to output HTML in the end. In a nutshell, web pages are HTML documents and that is the language that web browsers understand.
HTML dictates what you will see on the page and how various page elements relate to each other. As Scott Hanselman is fond of saying, you are creating an angle-bracket generator. HTML, like XML and SGML, uses a lot of angle brackets.
CSS and JavaScript are "optional" technologies that you can layer on top of HTML. My apologies if my explanation is too obvious. Your question is quite broad.
CSS is a language (but not really a programming language) that instructs the browser how to "present" the HTML. CSS controls things like color, size, position, etc of your HTML. CSS is what allows your HTML to adapt to different devices, screen sizes or even different media (such as on-screen vs print). CSS also controls some simple "behaviour" such as how HTML elements should react when you hover over them and the like. These days, CSS can even be used to create animation.
JavaScript is a programming languages that allows you to manipulate your HTML to create complex behaviours beyond the capabilities of HTML and CSS. Typically, JavaScript is used to implement more dynamic or interactive features. In particular, AJAX is the technology that has enabled what some people call Web 2.0 applications. These days the combination of modern JavaScript, AJAX, CSS, and HTML is often simply called HTML5.
Most web application frameworks that I have seen primarily generate HTML but the fancier ones do generate JavaScript for you as well. For example, a common "enhancement" is to allow the creation of HTML links (anchors) that act like buttons. Often, there is some boiler-plate CSS created just to make the default output prettier but mostly the CSS is left up to the end-user to craft.
So, your view is simply going to output HTML. If you want to be buzz-word compliant, say that it generates HTML5!
Now, all I have done is tell you what to generate. Your actual question was what you need to generate it. Well, it sounds like you are writing a Java framework. The answer then is that you would use Java to generate the view. So, what do you write in Java?
Well, you need some kind of template engine that generates HTML (or HTML5) from the templates that your users write. You need a framework that sits under your "views". I presume that you will be creating an MVC framework so another thing that you will need to provide is the code and conventions to support the easy creation of "controllers". You will also need to integrate your framework into a web-server (or write a web-server yourself as your title suggests) so that the framework can be called when somebody requests a ".jow" file. If you are doing MVC, the general best practice is to have the controller get called first and for it to decide which view to return.
A basic explanation of how to create a web server in java can be found here (and a lot of other places).
Or...you could just use one of the many Java web frameworks that already exist.
Upvotes: 1