Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sum of all drop down values

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1722
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic