User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 423,610 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,201 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 388 | Replies: 1
Reply
Join Date: Aug 2007
Posts: 40
Reputation: mimsc is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
mimsc mimsc is offline Offline
Light Poster

catch without try error

  #1  
Aug 13th, 2007
any suggestions?...im thinking somewhere between lines 163-185, but I'm stumped

  1.  
  2. <%@ page language="java" %>
  3.  
  4. <%@ page import="trader.webservices.data.LeadDAO" %>
  5. <%@ page import="trader.aabacrm.LeadsList" %>
  6. <%@ page import="trader.webservices.data.*" %>
  7. <%@ page import="trader.webservices.presentation.Lead" %>
  8. <%@ page import="trader.webservices.data.UserInfoDAO" %>
  9. <%@ page import="trader.webservices.data.UserDataVO" %>
  10. <%@ page import="trader.webservices.data.ButtonDAO" %>
  11. <%@ page import="trader.webservices.constants.UserConstants" %>
  12. <%@ page import="trader.webservices.util.Utils" %>
  13. <%@ page import="java.math.*" %>
  14.  
  15.  
  16. <%
  17. RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/ErrorPage.jsp");
  18.  
  19. UserDataVO userData = null;
  20.  
  21. String username = request.getParameter("username");
  22. String password = request.getParameter("password");
  23.  
  24. boolean loginOkay = false;
  25. boolean trialOkay = true;
  26. boolean pageError = false;
  27.  
  28. if ((username != null) && (password != null)) {
  29. loginOkay = UserInfoDAO.verifyLogin(username,password);
  30. if (loginOkay) trialOkay = UserInfoDAO.checkTrialOkay(username);
  31. }
  32.  
  33. if (loginOkay && trialOkay) {
  34. try{
  35. /**
  36. * Get accountInfo based on accountName
  37. */
  38. if (username != null) {
  39. userData = UserInfoDAO.getUserInfo(username);
  40. }
  41. if (userData != null) {
  42. userData.setHeaderLogo(UserInfoDAO.getHeaderLogo(userData));
  43. userData.setMaxMB(UserInfoDAO.getMaxMB(userData.getAccountID()));
  44. UserInfoDAO.getCriticalPathData(userData);
  45.  
  46. } else {
  47. pageError = true;
  48. }
  49. }catch(Exception e){
  50. request.setAttribute("pageError","An error occured trying to log into control panel.");
  51. dispatcher.forward(request, response);
  52. }
  53. }
  54. String mainpageText = UserInfoDAO.getMainpageText(userData);
  55. %>
  56.  
  57. <%
  58. // preparse results of the transfer to emc and other specific pages that send back to here, if applicable
  59. String otherResults = "";
  60.  
  61. try {
  62. if (request.getParameter("lastAction").equals("emcTransfer")) {
  63. int leadsUpdated = Integer.parseInt(request.getParameter("lead_upd"));
  64. int leadsCreated = Integer.parseInt(request.getParameter("lead_new"));
  65. int leadsErrored = Integer.parseInt(request.getParameter("lead_err"));
  66. otherResults = "You transferred " + (leadsUpdated+leadsCreated) + " leads. " + leadsUpdated + " updated, " + leadsCreated + " new.";
  67. if (leadsErrored > 0) {
  68. otherResults = otherResults + " " + leadsErrored + " leads were duplicates or could not be transferred to the Email Marketing Center.";
  69. }
  70. }
  71. } catch (Exception e) {
  72. otherResults = "";
  73. }
  74. %>
  75.  
  76.  
  77.  
  78.  
  79.  
  80. <%
  81.  
  82. try
  83. {
  84. System.out.println("The domainName string is: " + domainName);
  85. //Get accountInfo based on domainName
  86. domainName = UserInfoDAO.removeHostRedirection(domainName);
  87. userData = UserInfoDAO.getUserInfo(domainName);
  88. }
  89. catch(Exception e)
  90. {
  91. System.out.println(e.getMessage());
  92. response.sendRedirect("../ErrorPageCPanel.jsp");
  93. }
  94.  
  95. //for beta controlpanel, get the domain name from the form post (this is how it always works in old cp)
  96. if (userData == null) {
  97. userData = UserInfoDAO.getUserInfo(request.getParameter("username"));
  98. }
  99.  
  100. if (userData!=null) {
  101. //get HashMap from biz layer of leads/contacts
  102. int agentId = userData.getAgentID();
  103. int adverId = userData.getAdverID();
  104. //System.out.println("agentId:" + agentId);
  105. //System.out.println("adverId:" + adverId);
  106. LeadsList leads = null;
  107. HashMap currLead = null;
  108.  
  109. String agentOrBroker = null;
  110. int agentOrAdverId = 0;
  111. if (adverId == 0) { //agent site
  112. agentOrBroker = "agent";
  113. agentOrAdverId = agentId;
  114. }
  115. else {
  116. agentOrBroker = "broker";
  117. agentOrAdverId = adverId;
  118. }
  119.  
  120.  
  121. if (sOrderBy.equals("")) {
  122. leads = new LeadsList(agentOrBroker,agentOrAdverId);
  123. }
  124. else {
  125. if (bOrderDesc)
  126. {
  127. String orderBy[] = sOrderBy.split(",");
  128. String expandedOrderBy = orderBy[0] + " DESC";
  129. for (int i = 1; i < orderBy.length; i++)
  130. {
  131. expandedOrderBy += "," + orderBy[i] + "DESC";
  132. }
  133. leads = new LeadsList(agentOrBroker,agentOrAdverId,expandedOrderBy);
  134. }
  135. else {
  136. leads = new LeadsList(agentOrBroker,agentOrAdverId,sOrderBy);
  137. }
  138. }
  139.  
  140. %>
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  149. <html xmlns="http://www.w3.org/1999/xhtml">
  150. <head>
  151. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  152. <title>Control Panel - Website &amp; Content</title>
  153. <link rel="stylesheet" type="text/css" media="screen" href="/JAABA/skins/aaDefault/styles/cp-contentwell.css" />
  154. </head>
  155.  
  156.  
  157. <body>
  158.  
  159. <jsp:include page="../Includes/controlPanel/sessionInfo.jsp" >
  160. <jsp:param name="username" value="<%=userData.getAcctName()%>" />
  161. </jsp:include>
  162.  
  163. <!--This sets up the javascript array that holds the leads. -->
  164. <script language="JavaScript">
  165.  
  166. int unViewedCt = 0;
  167. out.write("var jsLeads = new Array();\n");
  168. for (int i=0; i< leads.size(); i++) {
  169. currLead = (HashMap)leads.get(i);
  170.  
  171. out.write("jsLeads["+ i +"] = new Array();\n");
  172. out.write("jsLeads[" + i + "][0] = '" + currLead.get("PK_LEADID") + "';\n");
  173. out.write("jsLeads[" + i + "][1] = '" + currLead.get("CON_ID") + "';\n");
  174. out.write("jsLeads[" + i + "][2] = " + currLead.get("BO_VISIBLE") + ";\n");
  175. //could be null in the table but is NVL'd in the view
  176. // Integer currVis =(Integer) currLead.get("BO_VISIBLE");
  177. // System.out.println("currVis:" + currVis);
  178. // out.write("jsLeads[" + i + "][2] = " + Utils.getStringNull((((Integer)currLead.get("BO_VISIBLE")).toString()),"0") + ";\n");
  179.  
  180. if (new Integer(currLead.get("BO_VIEWED").toString()).intValue() == 0 ) {
  181.  
  182. unViewedCt++;
  183. }
  184. }
  185. </script>
  186.  
  187.  
  188.  
  189.  
  190. <div id="cWell" class="clearfix">
  191.  
  192. <h1>Welcome to your New Control Panel</h1>
  193.  
  194. <div id="cWellMain">
  195.  
  196. <%=mainpageText%>
  197.  
  198. <!-- START OLD SCHOOL NEWS BOX -->
  199. <table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td colspan="2" align="CENTER" bgcolor="#FFCF63"><font face="Arial,Helvetica,Sans-Serif" size="4"><b>Real Estate News</b></td></tr><tr><td><font face="Arial,Helvetica,Sans-Serif" size="3"><b>Consumer News</b></font><br>
  200.  
  201. <br><a href="news-sample.html" title="Consumers aren't being cocky when they expect to reap profits from the sale of their home, even in a down market. "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Consumers: "What Housing Bust?"</b></font><br>
  202. <font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
  203. <br><a href="javascript:submit_form_with_qs('newsstory=222917');" title="How do you really measure square footage in a condominium unit? "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Housing Counsel: The Quagmire Called Square Footage</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
  204. <br><a href="javascript:submit_form_with_qs('newsstory=222919');" title="A study prepared for the Mortgage Bankers Association of America estimates that incidence of home loan fraud jumped by 30"><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Mortgage Fraud Rising Fast; Florida and California Now the Hot Spots</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
  205. <br><a href="javascript:submit_form_with_qs('newspage=Consumer');"><font face="Arial,Helvetica,Sans-Serif" size="2" color="#993333"><b><i>More Consumer News</i></b></font></a><br>
  206. </td><td><font face="Arial,Helvetica,Sans-Serif" size="3"><b>Commercial News</b></font><br>
  207. <br><a href="javascript:submit_form_with_qs('newsstory=222920');" title="An entire team working for you -- even when you sleep? "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>A Day In The Life Of A Virtually Supported Agent</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
  208. <br><a href="javascript:submit_form_with_qs('newsstory=222921');" title="Working from home can help real estate agents be more productive if they know how to make their surroundings function well"><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Ten Ways To Work Real Estate More Effectively From Home</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
  209.  
  210. <br><a href="javascript:submit_form_with_qs('newsstory=222822');" title="The California Association of Realtors (CAR) opposes private transfer taxes and has sought legislation that would prohibit them. "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Legislative Support for Private Transfer Taxes</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 22, 2007</i></font></a><br>
  211. <br><a href="javascript:submit_form_with_qs('newspage=Commercial');"><font face="Arial,Helvetica,Sans-Serif" size="2" color="#993333"><b><i>More Commercial News</i></b></font></a><br>
  212. </td></tr></table>
  213. <!-- END OLD SCHOOL NEWS BOX -->
  214.  
  215. </div><!-- end cWellMain -->
  216.  
  217.  
  218. <div id="cWellSide">
  219.  
  220.  
  221. <div id="stats">
  222. <h3><%= unViewedCt++ %></h3>
  223. <p>stats go here</p>
  224. </div>
  225.  
  226. <div class="ad">
  227. <div id="ad1"><p>To view product &amp; service opportunities from <strong>Agent Advantage</strong>, please install the <a href="http://www.adobe.com/go/gntray_dl_getflashplayer" target="_blank">Flash Plug-in</a>.</p></div>
  228. </div><!-- end ad -->
  229.  
  230. <div class="ad">
  231. <div id="ad2"><p>To view product &amp; service opportunities from <strong>Agent Advantage</strong>, please install the <a href="http://www.adobe.com/go/gntray_dl_getflashplayer" target="_blank">Flash Plug-in</a>.</p></div>
  232. </div><!-- end ad -->
  233.  
  234. </div><!-- end cWellSide -->
  235.  
  236. </div><!-- END cWell -->
  237. </body>
  238. </html>

thanx....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,454
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 129
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: catch without try error

  #2  
Aug 13th, 2007
A very simple answer, move all that scriptlet stuff out of this JSP into a (or probably multiple) beans.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 8:46 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC