Re: How to make a scrollable table using Jsp?
On Jan 28, 3:48 am, "eureka" <mseur...@rediffmail.com> wrote:
...
I am a novice programmer, I'm working with Jsp ..
i.e. HTML (so far as the user agent sees or cares) -
it is important to remember that.
...+ Javascript to develop a web application.
I have a floating table in my webpage which I achieved using JS. I
have written Jsp code to get database records one by one and append it
to this table(i.e basically the table is being created on the fly),
its all good till here but now I need to make this table scrollable
and thats where I'm stuck!
....
You got stuck when you jumped in at the deep
end, as many Java programmers who code JSP
or servlets do. The 'deep end' is trying to code
HTML and JS via. a third language.
Code:
<%
out.write("<html>\r\n");
Lew mentioned about the line feeds, but I
will point out that this HTML does not claim
to adhere to any W3C recommendation, and
that makes it harder for browsers to parse the
HTML correctly.
out.write("<head>\r\n");
out.write("<style type=text/css>table.T1 {overflow: scroll}</style>");
text/css should be enclosed in quotes or
delimiters 'text/css' or "text/css" it is best
to put styles into external stylesheets, both
to allow caching of styles, as well as to
ensure the styles can be easily validated.
out.write("<layer id = divStayTopLeft>");
Layer was some element invented by netscape,
I do not know if was a valid HTML 3.2 element,
but it sure is not valid in HTML 4.01 (which has
other, valid and reliable ways to replicate the
ability of layers)
out.write("<div align = right>");
Again with the lack of delimiters for attributes,
and inline styles (bad, bad).
out.write("<table class = T1 align = right border = 1 width=450
Putting a size to tables is (usually) a bad move,
they naturally assume as much space as they
need, and if the page becomes too thin, they
can automatically squeeze, to a point.
cellspacing = 0 cellpadding = 0 >");
out.write("<tr><td bgcolor=#FFFFCC><b>Candidate Name</b></td>");
The table cell BG color can be set, once
in the external, cached stylesheet, if you
specify the color as applying to TD elements
that are children of 'T1', you can even have
other normally colored tables on the page.
....
// Here I have the code for getting the backend-table's record and
appending it to the Html table as a new row.
....
The above code is supposed to make my table scrollable, but it doesn't
work, can someone check it for me please and advice me how to go about
it?
Create a static version of this as HTML 4.01,
change the layers for DIV's. externalise the
stylsheets and JS, validate the lot, then take
it to the comp.lang.javascript group and ask
their advice on your DHTML.
Once you have a (D)HTML page with a scrolling
table, that degrades gracefully (a JS term) to
pure HTML, rewrite the details into your JSP,
and Bob's your uncle.
HTH
Andrew T.