permaculture playing cards*
The moose likes Servlets and the fly likes How to obtain the contents of a td at the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to obtain the contents of a td at the servlet" Watch "How to obtain the contents of a td at the servlet" New topic
Author

How to obtain the contents of a td at the servlet

Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Hello,
i have created a table in jsp, i want to obtain the contents of a td at the servlet.
For example, here's one td of table:

I want to get this value in my servlet .
Could ou please tell me how can i do it ?
thank you in advance
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

By contents of td do you mean value of categoryname?


Swastik
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Yes
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Here's the code in my servlet:

an exception appears :

In your opinion, what is the problem?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

Can you translate that error line into english
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Here's the line translate to englissh :
The index of the column is out of range: 1, number of columns: 0.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Here's the important part from the stack trace:

at org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:47)
at com.pack.servlet.Delete.doGet(Delete.java:48)


This tells us that line 48 of your servlet com.pack.servlet.Delete is calling the setObject() method of some object. You have posted some other code.

And why are you using scriptlets like that? Scriptlets have been obsolete for years now. You should be using a EL expression there.
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Thank you for your reply,
where should i use the EL expression and how ?
Should i also use the input into a form ??
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Of course the <input> tag should be in a form. Look, I would suggest you should pause and spend some time learning HTML properly before you continue with this project. You aren't going to get anywhere if you're using several technologies which you know poorly, and trying to learn them by asking questions on a forum when you run into trouble isn't a good way to improve your skills.
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Thank you for your precious reply
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
Hi,
I made some changes in terms of my jsp code at the input tag hidden as follows :

When, i run my application no exception appears but the category name does not deleted from the database and a table in jsp page .
According to you, is that the problem of the structure of the jsp page?
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 272
hi,
finally, i found the solution
And the category_name deleted from the table and from the database,
but i have a new problem, when i want to insert another time, the same category deleted, an exception appears, this exception made by me,
here's the exception :

while the category is removed from the table of the database.
According to you, where's the problem?
 
Consider Paul's rocket mass heater.
 
subject: How to obtain the contents of a td at the servlet
 
Similar Threads
how to get form parameters data to a servlet?
Managing view of database data in jsp
best option for implementing form
Append a table inside a TD
Heap Dump