How to display html elements defined in xml file on jsp page
I'm currently working on a web application where in I'm continuously
adding new columns to the database tables for new projects. I don't want
to keep any dependency on java program to display new column details on
JSP page hence I want to define each and every html element/components
including attributes in the xml file and want to load them dynamically on
the web page (JSP). I know we can read below XML file using any java XML
parser but actual problem is while placing the html elements on the JSP
page.
I'm using struts 2 framework.
Sample XML file file
<?xml version= "1.0" encoding ="UTF-8"?>
<!DOCTYPE ROOTCOMPONENT [
<!ATTLIST COMPONENT
COMP_NAME CDATA #REQUIRED
COMP_TYPE CDATA #REQUIRED
LABLE CDATA #IMPLIED
SIZE CDATA #IMPLIED
TABLE_NAME CDATA #IMPLIED
COLUMN_NAME CDATA #IMPLIED
>
]>
<ROOTCOMPONENT >
<COMPONENT COMP_NAME="INPUT" COMP_TYPE="TEXT" LABLE="User Name" />
<COMPONENT COMP_NAME="INPUT" COMP_TYPE="PASSWORD" LABLE="Password"/>
</ROOTCOMPONENT>
Would it be possible? Does anyone knows how it can be achieve? Any sample
code snippet would be really helpful.
No comments:
Post a Comment