aspose file tools*
The moose likes Object Relational Mapping and the fly likes not able to delete specific record after selecting it as radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "not able to delete specific record after selecting it as radio button" Watch "not able to delete specific record after selecting it as radio button" New topic
Author

not able to delete specific record after selecting it as radio button

dibakar sinha
Greenhorn

Joined: Oct 02, 2011
Posts: 15
Using Spring mvc(using multiactioncontroller)how to delete a specific record after displaying them in a table and selecting them as radio button,,,, i can make code understand(in controller) which radio button is clicked but not able to get the userid(primary key) for that radio button!!!please give me some sample code here!!!
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

, i can make code understand(in controller) which radio button is clicked but not able to get the userid(primary key) for that radio button!!!please give me some sample code here!!!

Without much of details it's hard someone to help here. You need to tell more details (TellTheDetails).

What's the value passed to the controller in this case, is this the ID or something else? And what you have used to access the database so far, any ORM tool or plain JDBC etc...?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
dibakar sinha
Greenhorn

Joined: Oct 02, 2011
Posts: 15
my jsp from which i am reading which radio button is cliked is a below
<body><form action="jspcheck.do" method="post">
<%int i=0; %>
<table border="1" width="">
<tr>
<th></th><th>userId</th><th>userName</th><th>deptName</th>
</tr>
<c:forEach items="${user}" var="user">

<tr>
<td><input type=radio value="<%=i%>" name="group1"></td><td>${user.userId}</td><td>${user.userName}</td><td>${user.deptName}</td>
<%i++; %>
</tr>
</c:forEach><tr><td><input type="submit" name="delete" value="delete"></td></tr>
</table></form>
</body>
MY controller where I am sensing which radio button is clicked is as below
public ModelAndView jspcheck(HttpServletRequest request, HttpServletResponse response) throws Exception {
int i=0;
try {
for(i=0;i<10;i++) {
String value=request.getParameter("group1");
if(Integer.parseInt(value)==i) {
System.out.println(i+" radio button is selected");
int b=user.userId;
break;
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ModelAndView("redirect","message",i);
}


I am able to know which radio button is clicked but unable to get the user id related to that radio button....I am using Hibernate ORM
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not able to delete specific record after selecting it as radio button
 
Similar Threads
Call commandLink through radio button
exract the values of a row which is dynamically generated
jQuery - deselect same name radio buttons
help me out
Displaying images that match database records