Background info:
At my place of work we have this system to create new html pages.
Step 1: you copy a default template
Step 2: you copy snippets to create the elements that are on the page
This HTML page will use a COBOL program for its backend.
This a process takes up a lot of time and could easily be auto-generated with some user input. I've been learning Java on my own for a bit now and I came across design patterns. After checking out a few I'm completely lost on when to use one over the other. I use the Gagawa Java-library to create HTML nodes but I'm stuck on how to proceed further.
Some examples of the snippets:
A normal input field:
<label for="#id input field#" class="col-xs-3 control-label">
<!--NL-->Normal field<!--FR=Normal field (french)-->
</label>
<div class="col-xs-2">
<input type="text" class="insnal form-control" id="#id input field#" name="#id input field#" maxlength="#input max length#">
</div>
A date input field:
<div class="row">
<label for="#id input field#" class="col-xs-3 control-label"><!--NL-->Date field<!--FR=Date field (french)--></label>
<div class="col-xs-2">
<div class="input-group">
<input type="text" class="insnar form-control form-date" id="#id input field#" name="#id input field#" maxlength="10">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="but#id input field#"><span class="glyphicon glyphicon-calendar"></span></button>
</span>
</div>
</div>
</div>
As you can see, both pieces of code look very much alike
div:row -> label + div:col-xs-2 -> actual different elements
What I'm looking for is the best design pattern to create these types of things. It's pretty straight forward but with +- 15 of those snippets that use the same structure I would get a lot of double code if I just make a class for each one of them.
I'm just looking to create a program that asks the user to get some input and generate an HTML page using these snippets.
Aucun commentaire:
Enregistrer un commentaire