Link to home
Start Free TrialLog in
Avatar of changcy77
changcy77

asked on

how to handle a "grid" type of interface data access on the web

Dear experts,

I have a web application which has a page with "grid" style of data entry form. However, this is a 15X25 grid, which means there are 375 squares for people to enter their data(number). I am not sure how should I handle this type of data entry since it is impossible to name them all differently. On the other hand, at the database side, I only create one column for this field.

Any input?
Thanks.
Avatar of kennethxu
kennethxu

in this case, you can give all those grid the same name for example, keeping repeating this 375 times in the page:

<input type="text" name="fieldname">

when submit, just use
String[] fields = request.getParameters( "fieldname" );
now you have fields as an array of 375 strings.


HTH
Avatar of changcy77

ASKER

Thanks. In fact, I think it should be request.getParameterValues(field). You are very close.:)

By the way, do you know if we can use JavaBean tag to set property of an array filed? I mean if there is a field of the JavaBean--
String [] test;

Will setProperty set the value for us? I will reward points to expert who has the answer. Thanks.
>> In fact, I think it should be request.getParameterValues(field)
you are right! I just used IDE's autofinish too much, tend to forget exact method name. sorry about that.

I use:

<jsp:setProperty name="beanName" property="propertyName" value='<%=request.getParameterValues("fieldname" )%>'/>
ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, HTH.

I also wonder if there is a good way to populate the data into grid after retrieved from database. Since it might be a long process... do you know if JSP has any caching ability? Or other solution people might suggest?

>> do you know if JSP has any caching ability?
1. some web server and/or servlet container provide page caching.
2. for http 1.1 container and client. you can implement HttpServlet.getLastModified(HttpServletRequest req). to tell the browser there is no change after returned time.

>> Since it might be a long process
if you mean it take long time to retrive data from database, you can store result in a list or map, and save it in session or context scope.

but, please note that all those caching can be done only when data in database is quite static.
thanks.
but, since every query could be quite different, the result won't be the same, therefor, save it some where in the session, probably won't fit my case.

i am trying to concatenate all the strings of the array into one long string, which stored in the database. after retrieve from database, i use StringTokenizer to populate the grid one cell at the time-- which i think is slow. any other way? Thanks.
you said every query is different and then save it in database, I don't see what's the different between same in db and save in session. actaully i don't quite sure what exactly you want to achieve.
do you know where is the bottleneck of your application?