java - Should I store an HTML form in a database -


i wondering if considered bad practice store html content in database or if unsafe.

i looking implement several forms system have different fields , can change regularly. wondering if bad practice create each form's unique layout , store them in database. users won't able modify forms, submit html forms, or create own form without hacking our database. take data user submits , validate special characters before submitting data database table created each form. plan loop through request parameters pulling out key value pairs , either send validated list stored procedure or prepared statement. field names have same name, or similar name, column name in database. ensure have correct order, store information in map don't need hope information doesn't move around somehow.

the html page stored in clob in database along sql needed submit data client. might store table name data needs submitted , build statement around it.

example:

string tablename = "form1"; //pulled database string sqllayout = "insert ? ("+/*dynamically generated ? based on map keys*/+ ") values ("+ /*dynamically generated ? based on map values*/ +")"; //then proceed fill in ? in standard prepared statement way. 

to load clob client page, use jquery's .load() on div in jsp.

i work javaee application releases once year.

the main concern maintenance. if change database column, you'll have edit contents of database record storing form , respective sql code.

hacking not issue. not matter how you'll render form page. in end it's html code anyway.

i store text file, html snippet or json file mentioned doveyg.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -