Problem reg. Delete Operation in my struts application
Jay Shukla
Ranch Hand
Joined: Jun 08, 2008
Posts: 214
posted
0
Hi All,
I'm creating a strut application. In this User will click Sign In Link and will enter username/password and after that will be anle to see all the records from database along with Delete link at the end of each records.
But when I click record that record is not deleted. I found that the function in which delete query is mentioned is not being called at all But i am not able to find what is the problem / going wrong. I am not getting any error / Exception. But page goes blank when i click Delete link at end of a record.
Below is the codes.
struts-config.xml
============
userlist.jsp (This is the JSP for displaying the records).
===================================
removeUser Function from LogonData Class
=============================
DeleteUserAction.java
===============
Please help me resolving problem related to delete function.
I have several concerns about this code, including SQL injection and web crawlers.
That aside, it appears as though the HTML you posted was partially messed up.
If nothing else, you should set logging to DEBUG level and check the logs for any exceptions--I'd imagine there's one there.
Also, try to take care to keep your code clean--there's no reason to try to close a result set that will never be not null. Commented-out code just obfuscates the real code and makes it more difficult for us (and you) to see what's going on. There's no need to ever call new String("foo")--just use an immediate string. You don't need to check to see if errors is empty immediately after adding an error.
Clean code counts--and it makes tracking down issues much, much easier.
Jay Shukla
Ranch Hand
Joined: Jun 08, 2008
Posts: 214
posted
0
Hi David,
Thanks for reply and valuable suggestions. Actually i'm new to struts and following professional Jakarta Struts Books.
Anyway, Here is the userlist.jsp
Thanks in Advance.
Jay Shukla
Ranch Hand
Joined: Jun 08, 2008
Posts: 214
posted
0
It seems thereis a problem in the code that prints Delete link in the JSP. Hence i'm putting that snippet below.
Depends on what logging package you're using, but it starts with setting devMode to true for some basic info.
I use Log4J, so I use either a Log4J properties or XML config file to set up Struts 2 and/or XWork and/or OGNL to log at DEBUG level, depending on the nature of what I'm trying to track down.
Oops, you're using Struts 1. The Log4J stuff applies anyway, as far as I can recall.
Jay Shukla
Ranch Hand
Joined: Jun 08, 2008
Posts: 214
posted
0
Hi David ,
Thanks for reply. Currently i'm not using log4j package to my struts application. So is it fine if i define DEBUG level in web.xml as an init parameter?
I have no idea; if that will configure commons-logging, sure.
Jay Shukla
Ranch Hand
Joined: Jun 08, 2008
Posts: 214
posted
0
Hi,
Sorry for late reply.
I tried defining DEBUG level in web.xml but seems that its giving the same log.
Is there another way that can be configured?Even if i use log4j package where do i need to print the logging statements that will help to resolve this issue.