wood burning stoves 2.0*
The moose likes JSP and the fly likes sum of all drop down values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "sum of all drop down values" Watch "sum of all drop down values" New topic
Author

sum of all drop down values

Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 136
Hi,
I have a dropdown in my jsp with all users from database. When I select a user I'm able to get the details of the corresponding result, but when I click on all it should give the total individually. Below is the code that I use to get individually.


and the get result is as below.



Thanks
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Lets see

- Scriptlets in a JSP page
- Database queries in a JSP page
- Queries open to SQL Injection
- Scriptlet tags used instead of expression tags
<%String user2=rs.getString(1);out.println(user2);%>
should be
<%= rs.getString(1) %>
- Form submission invokes a JSP
- That sql query for retrieving users looks overly complicated - do you really need a hierarchical query to retrieve users? Using rownum in the query hints at troubles to me.

All in all, it looks like a horrible mess.
I'm not even 100% certain what your asking because it presumes knowledge of your application, your database structure, and whats in your head.

My suggestions:
- start smaller
- get a good book on JSP Web application design
- java code belongs in a java class - not in a JSP page. JSP should be using JSTL and EL
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sum of all drop down values
 
Similar Threads
How to get all dropdown values
Getting null in Database retrieval
How to get all dropdown values
Sql output in jsp table formatting
page refresh problem