1

Explanation. I am trying to figure out how to pass data in a way that will generate an HTML page based on user input from a JavaFX application.

My company needs a quick way to generate 5 email signatures for each employee, one for each of our child companies, all from the same input data. i.e.

[Company One Image]
*fName* *lName* | *Title*
*Phone* | *Fax*
*fName*.lName@company1.com

[Company Two Image]
*fName* *lName* | *Title*
*Phone* | *Fax*
*fName*.lName@company2.com

...etc

Basically I am converting JavaFX TextField to String and then trying to inject that into an HTML.

Can I drop my HTML code straight into Strings, concatenating the input data in, then generate and open a .html?

String companyOneSig = "<img src= "yaddayadda"><br>" + fName + " " + lName; 

Of course using proper escape characters...

Do I have to utilize JavaScript in some way to handle the variables? Can I just write to a .txt?

If anyone can give me a direction without my laziness having to dig through API's.

NSTuttle
  • 3,237
  • 2
  • 17
  • 26
  • 1
    The fastest way is definitely with string concat and [html escaping](http://stackoverflow.com/q/1265282/4464702). If you need more than that, there are libraries called "template engines" which do exactly that (Thymeleaf, FreeMarker, etc...) – randers Jan 14 '16 at 20:30
  • 1
    Yes, you can generate html using nothing but Java. You probably want to write it to an .html file though. – ChiefTwoPencils Jan 14 '16 at 20:31
  • Awesome, I figured this much but I didn't want to get too far into it and find I just wasted limited time. I appreciate the quick responses @RAnders00 – NSTuttle Jan 14 '16 at 20:44
  • and @CheifTwoPencils – NSTuttle Jan 14 '16 at 20:44

0 Answers0