Dynamic table

I have a jsp form called view.jsp.

When the user clicks the add button, a pop window would pop up and asks the user to enter the details such as

  Name of Color,
  Type of Color,
   Description,
When the user has entered the details, he presses the ok button on the pop up window, the data gets inserted into the database
(The user could add as many as color and details and table grows)

My problem is that i need to display the details of the color in a dynamic table( i don't know how) with a checkbox and the details
For example
Checkbox | Name of Color|Type of Color|Description

How do i add this to the dynamic table and i need not explicits refresh the view the jsp( i don't know how)

The name of table is Col
Fields
Colorid | typeColor| Desc|

Thanks
Jasbir21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KaraaCommented:
the details  of color are coming from db or some where else?
0
KaraaCommented:
<%
String cname;/// coming from db
String   check="checked"; or check="";/// this check variable may have two values coming from database either "checked" or ""
%>
use some For loop

<td width="5"><input type="Checkbox" name="gar" value="pot" <%  out.print(check);%>><br></td>
<input name="color" type="text" id="colorname" value="<%=cname%>" size="19" align="top" width="110" >
0
KaraaCommented:
if u want to do SQL search of table from db u can use
String      str = "SELECT color,type,desc,checked FROM Col";
            rset = stmt.executeQuery(str);%>
<%
            while (rset.next())
                  {
                  String cname= rset.getString(1);
                  String type= rset.getString(2);
String desc= rset.getString(3);
String checked= rset.getString(4);

                  %>
                  <td width="5"><input type="Checkbox" name="gar" value="pot" <%  out.println(checked);%>><br></td>
<td ><input name="color" type="text" id="colorname" value="<%=cname%>" size="19" align="top" width="110" > </td>      
<td ><input name="type" type="text" id="type" value="<%=type%>" size="19" align="top" width="110" > </td>      
<td ><input name="desc" type="text" id="desc" value="<%=desc%>" size="19" align="top" width="110" > </td>                  <%      }      %>
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Jasbir21Author Commented:
Hi,
 
  I tried that but i got this error:server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.NullPointerException
      org.apache.jsp.jsp2.orga_jsp._jspService(orga_jsp.java:259)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


Thanks
0
kennethxuCommented:
if you don't want to refresh the view.jsp, then there is an example of how to do it with javascript:
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20676182.html
it was about another question but have the right example in it.
0
KaraaCommented:
The reason may be you have not initialised JSP variables
0
KaraaCommented:
it is better you post your code
0
Jasbir21Author Commented:
....java bean classes and connection with database
My problem is that when the user clicks the new button , the project.jsp should be displayed and when the info is entered the page needs to be refreshed or what ever (dynamic table needs to be displayed)
Could anyone plssssssssss help me , i really  needs this urgently

This is the part of the code:

<table border="2" BGCOLOR="#FFFFF0" width="80%" CELLPADDING="4">
<tr>
<td>
<input type="checkbox" name="chk" value="yes" style="background=cornsilk; border=0;">
</td>
<td>
Project Name
</td>
<td>
Description
</td>
<td>
Duration
</td>
<td>
Skills Required
</td>
</tr>
</table>

</p>
<input type=button value="New" >
<input type=button value="Edit">
<input type=button value="Delete">
</p>
<input type="submit" value="Submit">
</form>
</font>
</body>
</html>
0
kennethxuCommented:
>> Could anyone plssssssssss help me , i really  needs this urgently
we need more information to help you, you might want to help you self by response to us quickly.

can you please post what you have for your view.jsp? or let us know if you don't even know where to start.
0
Jasbir21Author Commented:
so sorry for the late response.

 I don't know where to start, except that my connections the database and everything works fine, and for the dynamic table part i just have that html code,
The rest of the form is just enterin g data...


Thanks
0
kennethxuCommented:
assuming you know how to get a resultset from database:

<% while( resultSet.next() ) { %>
<tr>
<td>
<input type="checkbox" name="chk" value="yes" style="background=cornsilk; border=0;">
</td>
<td>
<%=resultSet.getString( "ProductName" )%>
</td>
<td>
<%=resultSet.getString( "Description" )%>
</td>
<td>
<%=resultSet.getString( "Duration" )%>
</td>
<td>
<%=resultSet.getString( "SkillsRequired" )%>
</td>
</tr>
<% } %>
0
Jasbir21Author Commented:
Hi,
  Sorry for not being clear from the beginning :
<input type=button value="New" >
<input type=button value="Edit">
<input type=button value="Delete">

 My problem when the user clicks the new button, a window should pop up, called project.jsp.
Where the user is able to enter data into table project.When the user clicks submit button on project.jsp the dynamic table in view.jsp needs to be displayed.
There is also other information entered by the user on view.jsp.
I mean, how can it be done if the user
clicks new, the project.jsp pops-up ,user enters info press submit, it gets displayed on view.jsp(dynamic table) with other info of user..


Thanks
0
kennethxuCommented:
so your question is rather on how to handle the popup windows instead how to display a dynamic table with data from database.

read this thread from beginning to the end and you should know what you need to do.

Let me know if you have futher enquires.
0
kennethxuCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jasbir21Author Commented:
thank you ans sorry for the late reply....
0
kennethxuCommented:
glad to know your problem is resolved and thanks for the A grade.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.