aspose file tools*
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
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: 144
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: 1018
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