This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have to render a JSP page based on a database table.
For example, there are two tables, one is having 2 columns and another is having 3 columns.
I will give one of the table name as input, based on this it should be able to render the next page. For the moment we can think all columns are having varchar2 datatype, so all fields should be rendered as text boxes.
Can you please suggest how to write JSP code for above requirement?
Struts 2 exposes data to JSPs through public getter methods: if you have a list (for example) of results of a DB query:
Then in the JSP:
Since you appear to be using scriptlets (almost always a Bad Idea) you could just put the list into request scope by either (a) implementing RequestAware (recommended) or (b) using the ServletActionContext utility class (not as testable).