Advertisement

04.25.2008 at 11:11AM PDT, ID: 23354393
[x]
Attachment Details

need assistance with jsp code

Asked by sadaf_syed in Java Server Pages (JSP), Miscellaneous Programming, Miscellaneous Web Development

i have this code that helps pull a user list from a database table called S_USER but i need it to verify if the user is active and only print active users. the active field is called "ACTIVE" so i basicall need the code check if user_id is active then print user_id. attached is the jsp code. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
<html>
<head>
<%@ include file="/header.jsp" %>
<%@ page import = "com.synfoserv.beans.*" %>
<%@ page import = "java.util.*" %>
<jsp:useBean id="listing" class="java.util.ArrayList" scope="request"></jsp:useBean>
<title><database:label controlname="header_userlist" disablebold="true"/></title>
 
	
<SCRIPT language="JavaScript">
function deleteRecord(userid) {
	document.forms[0].cmd.value = "suser_delete";
	document.forms[0].userid.value = userid;
	document.forms[0].submit();
	
}
 
function deleteRecord(userid) {
	var msg = 'Delete User?';
	var x=window.confirm(msg)
	if (x) {
		document.forms[0].cmd.value = "suser_delete";
		document.forms[0].userid.value = userid;
		
		parent.main_mid.location = "Controller?cmd=blank_page";
		document.forms[0].submit();
	}
}
parent.main_mid.location = "Controller?cmd=blank_page";
parent.menu.location = "Controller?cmd=remove_company";
parent.main_bottom.location = "Controller?cmd=blank_page";
</SCRIPT>	
</head>
<%
 
UserBean uBean = (UserBean) session.getAttribute("userbean");
Hashtable htSecurity = uBean.getSecurity();
SecurityBean sb = (SecurityBean) htSecurity.get("USER");
 
boolean bSecurityRight=false;
 
bSecurityRight=sb.getDelete();
 
 
%>
<body class=stdbody>
<form name=dataentry action="Controller" method="post">
<input type="hidden" name="cmd" value="">
<input type="hidden" name="userid" value="">
<TABLE width="100%" cellpadding="0" cellspacing="0">
  <TR>
    <TD  colspan="4">
      <TABLE width="100%" cellpadding="0" cellspacing="1">
        <TR>
          <TD class=titlerow><database:label controlname="header_userlist" disablebold="true"/></TD>
        </TR>
	  </TABLE>
	</TD>
  </TR>
  <TR>
  <TR>
   <TD>
      <TABLE width="100%" border="0">
        <TR>
          <TD class=headerow>Connected</TD>
          <TD class=headerow><database:label controlname="user"/></TD>
          <TD class=headerow><database:label controlname="fname"/></TD>
          <TD class=headerow><database:label controlname="lname"/></TD>
          <TD class=headerow><database:label controlname="department"/></TD>
          <TD class=headerow><database:label controlname="phone"/></TD>
          <TD class=headerow><database:label controlname="email"/></TD>
          <td class=headerow></td>
        </TR>
<%
Iterator iter = listing.iterator();
boolean isHighlighed = false;
boolean hasrows = false;
int intListCount = 0;
while (iter.hasNext()){
        intListCount++;
	hasrows = true;
	SUserListBean  ulbObj = (SUserListBean) iter.next();
	%>	
        <TR class= <% if (isHighlighed){
				out.println ("labelcolumn");
			} else {
				out.println ("textcolumn");
			}
		%>onmouseover='this.style.backgroundColor = "#CC9933";this.style.cursor="hand";' onmouseout='this.style.backgroundColor = "";this.style.cursor="default";' this.style.cursor='default'">
<!-- 
          <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getUserId()%></TD>
	  <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getFName()%></TD>
	  <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getLName()%></TD>
          <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getDepartment()%></TD>
	  <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getPhone()%></TD>
	  <TD onClick="parent.main_bottom.location='Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>'"><%=ulbObj.getEmail()%></TD>
-->
          <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getConnected()%></TD>
          <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getUserId()%></TD>
	  <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getFName()%></TD>
	  <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getLName()%></TD>
          <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getDepartment()%></TD>
	  <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getPhone()%></TD>
	  <TD onClick="javascript:loadEditFrame('Controller?cmd=suser_edit&userid=<%=ulbObj.getUserId()%>')"><%=ulbObj.getEmail()%></TD>
	  <%if (bSecurityRight){%>
	  <TD onClick="deleteRecord('<%=ulbObj.getUserId()%>')"><img src="<%=htConfig.get("delete_button")%>" border="0" alt="" width="15" height="15"></TD>
	  <%}else{%>
	  <TD><img src="<%=htConfig.get("delete_button_disabled")%>" border="0" alt="" width="15" height="15"></TD>
	  <%}%>
	</TR>
	
 <% isHighlighed = !isHighlighed;
 }
if (!hasrows){
 
 %>
 <TR class=textcolumn>
 			<td colspan=9><database:label controlname="norecord"/></td>
         
		</TR>
 
 <%} 
else{%>
  <TR class=labelcolumn>
    <td colspan=1>List Count</td>
    <td colspan=11><%=intListCount%></td>
  </TR>
<%}%>
	</TABLE>
</body>
</html>
 
 
[+][-]04.26.2008 at 12:12AM PDT, ID: 21444788

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Server Pages (JSP), Miscellaneous Programming, Miscellaneous Web Development
Sign Up Now!
Solution Provided By: cmalakar
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628