Prev: String.intern() (Was: create a string of <n> equal chars <c>)
Next: Easiest way to read a XML doc from file, reformat it and write it indented to a second file?
From: john on 15 Jul 2010 08:47 I have a input form like this : COLUMN1 NAME1(outputText) COLUMNNAME2(outputText) COLUMNNAME3(outputText) ROW NAME(outputText) | 20.4 (inputText) | 10.1 (inputText) | 3.3 (inputText) | the problem is that I will have more than 300 rows. My question is is it better to have hardcoded jspx like this below, or to put dataTable which will have class like this class Form{ private String rowName; private String columnOneValue; ....... } and generate that form from DB data, and how would that table in DB looked like ? Thanks in advance.
From: Lew on 15 Jul 2010 09:03 On Jul 15, 8:47 am, john <j...(a)preparew.com> wrote: > I have a input form like this : > > COLUMN1 NAME1(outputText) > COLUMNNAME2(outputText) COLUMNNAME3(outputText) > ROW NAME(outputText) | 20.4 (inputText) > | 10.1 (inputText) | 3.3 > (inputText) | > > the problem is that I will have more than 300 rows. My question is is it > better to have hardcoded jspx like this below, or > to put dataTable which will have class like this > > class Form{ > > private String rowName; > private String columnOneValue; > ...... > > } > > and generate that form from DB data, and how would that table in DB > looked like ? > Taking your last question first, your question is equivalent to, "I have to design a database. What should my tables look like?" There's no way to answer that without knowing something of the data you wish to store. In general terms, you want to create a normalized relational representation of data used by your domain model. You should know what words like "normalized" mean in this context; if not, look them up. As to your screen form, you mention JSP and JSF and a 300-row form. First question: How user friendly is a 300-row form on a screen? Are you for real? Presumably the 300 rows have similar structure, e.g., (name, comment, value) type of thing. That would mean each row represents info from a single entity, the same type of entity for each row. That's what a JSF 'dataTable' is for. You specify all the iteration parameters in the 'dataTable' attributes, and define the rows with suitable 'outputText' and 'inputText' tags. The database lookup is NOT done directly from the screen but by the managed backing bean that provides the values for the JSF components. -- Lew
From: john on 15 Jul 2010 09:46
On 15.7.2010 15:03, Lew wrote: > On Jul 15, 8:47 am, john<j...(a)preparew.com> wrote: > >> I have a input form like this : >> >> COLUMN1 NAME1(outputText) >> COLUMNNAME2(outputText) COLUMNNAME3(outputText) >> ROW NAME(outputText) | 20.4 (inputText) >> | 10.1 (inputText) | 3.3 >> (inputText) | >> >> the problem is that I will have more than 300 rows. My question is is it >> better to have hardcoded jspx like this below, or >> to put dataTable which will have class like this >> >> class Form{ >> >> private String rowName; >> private String columnOneValue; >> ...... >> >> } >> >> and generate that form from DB data, and how would that table in DB >> looked like ? >> >> > Taking your last question first, your question is equivalent to, "I > have to design a database. What should my tables look like?" > > There's no way to answer that without knowing something of the data > you wish to store. In general terms, you want to create a normalized > relational representation of data used by your domain model. You > should know what words like "normalized" mean in this context; if not, > look them up. > > As to your screen form, you mention JSP and JSF and a 300-row form. > First question: How user friendly is a 300-row form on a screen? Are > you for real? > > Presumably the 300 rows have similar structure, e.g., (name, comment, > value) type of thing. That would mean each row represents info from a > single entity, the same type of entity for each row. That's what a > JSF 'dataTable' is for. You specify all the iteration parameters in > the 'dataTable' attributes, and define the rows with suitable > 'outputText' and 'inputText' tags. > > The database lookup is NOT done directly from the screen but by the > managed backing bean that provides the values for the JSF components. > > -- > Lew > I was agaist that number(300) of rows in form, but at the end it has to be done, and I know it' far from practical. The form is very simple , names of rows are Strings(varchar), and input values are bigdecimal-s. Another problem is that i have one similar jspx diferencinf from the first one by maybe 2 or three rows, and how to design lookup table so I wouldn't have large number of redundand data. So far I have a table in DB like this TABLE ONE : ID ROWNAME SORTNUM COLUMNNAME FORMTYPE 1 example 1.0 example 1 2 example2 1.1 example2 1 and so on.... TABLE 2 : FK(ID) SORT NUM COLUMNVALUE 1 1.0 10 2 1.1 15 and now on refreshView of jspx search is done in TableOne and Two and dataTable is generated. Sort num in table one sorts row names by order in table, and sort num in table two sorts culumns. Form type indicated for what for the attributes are.This works very well and dataTable is generated, but the problem is that if I need to generate some form like this I will have much redundant data in both tables, and just FORMTYPE column will change and will have for example value 2. Any help ? |