?
Solved

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

Posted on 2003-03-18
9
Medium Priority
?
207 Views
Last Modified: 2010-04-01
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.
0
Comment
Question by:changcy77
  • 5
  • 3
8 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 8159637
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
0
 

Author Comment

by:changcy77
ID: 8160212
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.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8161504
>> 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" )%>'/>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 14

Accepted Solution

by:
kennethxu earned 150 total points
ID: 8162964
you can still use
<jsp:setProperty name="bean" property="names"/>
or
<jsp:setProperty name="bean" property="names" param="frmName"/>

as long as you define your bean correctly:

public class SimpleBean {
    private String[] names = null;
    public void setNames( String[] names ) { this.names = names; }
    public String[] getNames() { return names; }
}
0
 

Author Comment

by:changcy77
ID: 8174078
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?

0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8174937
>> 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.
0
 

Author Comment

by:changcy77
ID: 8181890
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.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8182241
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?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my humble opinion (IMHO), TouchDown from Symantec is the best in class for this type of application, but Symantec has end-of-lifed it and although one can keep using it, it will no longer be supported or upgraded.  Time to look for alternatives t…
Ready to kick start your career in 2018? Add app developer skills to your resume. January’s Course of the Month features Android App Development training with hands-on learning.  Read on to learn why these skills are important.
Screencast - Getting to Know the Pipeline
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question