I have a staff record here and I need to let if go through a function and the function spits out the staff record nicely formatted with HTML tags.
example
staff id = 23422
first name = Herbert
surname = Dominos
department = Purchasing
function output would be something like
<label>staff id</label><div class="some class">23422</div>
<label>First namelabel><div class="some class">Herbert</div>
<label>Surname</label><div class="some class">Dominos</div>
<label>Department</label><div class="some class">Purchasing</div>
Seems just concatenating them via string or stringbuilder is not the right way to do it.
Any suggestions? thanks :)
String&StringBuilderthen definitely no to the first. As to whether it is best to useStringBuilderover many of the other ways of generating HTML, e.g. JSP or servlets, jsoup.. - that is another matter. I 'hand role' methods to do simple HTML structures like the cells and rows of tables.<label>First namelabel>it should be<label>First name</label>;)