mimsc 0 Junior Poster in Training

Hello all. Im a Java developer, but have been given the extra title of Perl developer also. So im new to the code structure. Basically Im trying to pull the width and height from a url example below and display in an error msg just to test:

http://...readimage?1234a&height=10&width=10

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI::Fast qw(:standard);
use LWP::UserAgent;
use Sys::Hostname;
use File::stat;
use Date::Format;
use Image::Magick;

### Image Path Hash Module
require "/web/images/perl/hash.pm";

my $image_path = '/web/images';
my $image_path_old = '/web/imgsrv';
my $ecode;
my %GET = ();
my $width;
my $height;

while ( my $cgi = new CGI::Fast ) {
   %GET = $cgi->Vars();

   if ( $GET{'keywords'} || $GET{'width'} ||  $GET{'height'} ) { # Data was included, attempt to process (stops bare readimage calls)
my $external_id;
$width = $GET{'width'};
$height = $GET{'height'};
$external_id = $GET{'keywords'};

      if ( $ENV{'PATH_INFO'} ) { # Called via / (PATH_INFO will contain either a URL or an external ID)
         if ( $ENV{'PATH_INFO'} =~ /\/http:\// ) { # This is a separate logic branch for image URLs (Note the single slash in the RE--double slashes are int$
            if ( $ENV{'PATH_INFO'} !~ /\.exe$/ ) { # This will prevent URLs with .exe extensions from being processed
               if ( $ecode = run_url('http://' . substr($ENV{'PATH_INFO'}, 7), $cgi) ) { # substr() fixes the double/single slash problem caused by the HTTP$
                  error($cgi, "URL processing failed, error number $ecode");
               }
               next();
            } else {
               error($cgi, 'Invalid URL (.exe detected)');
               next();
            }
         }
         error($cgi, 'Valid External test1 ID …
mimsc 0 Junior Poster in Training

I figured it out!!

var custName = document.forms[0].custName.value;

http://<%=accountName%>/JAABA/jsp/cpanel/homeSellerReport3.jsp?propId=<%=propId%>&custName=' + custName


oh yeaaaaaa

mimsc 0 Junior Poster in Training

Hello guys I normally write java...but heres my question

int propId = Integer.parseInt(request.getParameter("property"));

 <script type="text/javascript">
   			
   			function doReport1() {
   			  document.forms[0].target = "_blank";
              document.forms[0].action = 'http://<%=accountName%>/JAABA/jsp/cpanel/homeSellerReport1.jsp?propId=<%=propId%>';
              document.forms[0].submit();
            }


<div class="marginTopBump5 marginBottomBump9">
							<div class="left paddingRight2 paddingTop21">Dear</div>
							<input type="text" name="custName" maxlength="100" size="40" value="" class="fullBox left" />
							<div class="left">&nbsp;,</div>

as you can see I pass in propid as <%=propId=> to the url because I have it declared at the top in the scriptlet

How can I pass over a form parameter such as "custName" in that url although its not a scriplet declaration??

thanx

mimsc 0 Junior Poster in Training

Hello..Im trying to read the HTML from a URL and I threw in yahoo.com as a test...for some reason, "n.readLine()" is coming back as NULL and the while loop fails...and ideas??

thanx

<%@ page import="java.io.*" %>
<%@ page import="java.net.*" %>
<%@ page language="java" %>
<%@ page import="trader.webservices.util.Utils" %>
<%@ page import="trader.webservices.data.UserDataVO" %>
<%@ page import="trader.webservices.data.UserInfoDAO" %>
<%@ page import="trader.aabamail.AABAmailDAO" %>
<%@ page import="trader.aabamail.OutgoingMessage" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
 <% 
 	UserDataVO userData = null;
    
 	//String username = request.getParameter("username");
	//String password = request.getParameter("password");
	String flyRequest = request.getParameter("flyRequest");
	String email = request.getParameter("emailAdd");
 
	String domainName	= UserInfoDAO.removeHostRedirection(request.getServerName());
	
	String adminServer = request.getServerName();
	String javaAdminServer = request.getServerName();
	
	
	
	
	if (request.getServerName().equals("localhost") || request.getServerName().startsWith("199")) {
			adminServer = "cpanel.homes.com";
			javaAdminServer = "localhost:8080";
	 }
	
			userData = UserInfoDAO.getUserInfo(domainName);
			String accountName = userData.getAcctName();
	
	URL flyUrl = new URL("http://www.yahoo.com/");
	
	BufferedReader in = new BufferedReader(new InputStreamReader(flyUrl.openStream()));
	String flyerInputLine;
	
	
	while ((flyerInputLine = in.readLine()) != null)
	    System.out.println(flyerInputLine);



	in.close();

	
		
			

	//This is the body of the email
	
	
	
	
   OutgoingMessage msg = new OutgoingMessage();
   msg.setFromAddr("clarence_mims@yahoo.com");
   msg.setFromName(accountName);
   msg.setToAddr(email);
   msg.setSubject("test");
   msg.setContent(flyerInputLine);
   msg.send();
	
	
 
   
   %>
   
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Email Flyer</title>
   <link rel="stylesheet" type="text/css" media="screen" href="/Listings/resources/css/cp-contentwell.css" />
		<link rel="stylesheet" type="text/css" media="screen" href="/Listings/resources/css/cp-tablesort.css" />
		<!--[if IE]>
		<link rel="stylesheet" type="text/css" media="screen" href="/Listings/resources/css/cp-ie.css" />
		<![endif]-->
    </head>
    <body>
       <div id="cWell">
			<h1 class="tab4dark">Email Flyer</h1>

				<div id="msgBox2">
					<ul>
						<li>Your flyer has been sent. Thank you!<%=flyRequest%><%=flyerInputLine%>
						
						
						 </li>
					</ul>
			</div>
        </div>
	</body>
</html>
mimsc 0 Junior Poster in Training

<%=URLDecoder.decode(newsSubTitle.elementAt(i))%>

should be:

<%=URLDecoder.decode((String)newsSubTitle.elementAt(i))%>

mimsc 0 Junior Poster in Training

I thought I got the class path right??

lines 89 and 94 throwing the error

<%@ page language="java" %>
<%@ page import="trader.webservices.util.Utils" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="trader.webservices.util.AABAHeaderFooter" %>
<%@ page import="trader.webservices.data.UserDataVO" %>
<%@ page import="trader.webservices.data.UserInfoDAO" %>


<%  
	RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/ErrorPage.jsp");

	UserDataVO userData = null;
	
	
	String domainName	= UserInfoDAO.removeHostRedirection(request.getServerName());
	//TESTING PURPOSES
	domainName	= "pattymcnease.com";
	//domainName	= "traceysellscthomes.com";
	//domainName =    "ellenclark.topseller.net";
	//int partnsId = Integer.parseInt(request.getParameter("partnerId")); 
	

		

		try{
			
			userData = UserInfoDAO.getUserInfo(domainName);
		}catch(Exception e){
			request.setAttribute("pageError","The account URL ("+domainName+") was not valid.");
			dispatcher.forward(request, response);
		}
		
		String parentPage = request.getParameter("parentPage") == null ? "": request.getParameter("parentPage");
		//int accountID = userData.getAccountID();
    	
		String accountName = userData.getAcctName();
		int acctId = userData.getAcctId();
		
    	
				
		Vector newsId = UserInfoDAO.getNewsID();
		Vector newsTitle = UserInfoDAO.getNewsTitle();
		Vector newsSubTitle = UserInfoDAO.getNewsSubTitile();
		Vector newsDate = UserInfoDAO.getNewsDate();
		
				
		//String imageUrl = "http://www." + domainName + "/dev/plus/images/";
		//String imageUrl = "http://www." + domainName + "/files/" + acctId + "/";
		
		
		
		
		
				
		%>
		




<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
	<TR>
		<TD>
			<FONT FACE="ARIAL NARROW,HELVETICA" SIZE="2">
			<CENTER>
			<B>Real Estate News</B><BR>Find out what's happening in real estate.
			<HR>
			</CENTER>
		</TD>
		<TD>
			<IMG ALIGN=RIGHT SRC="http://cdn.homes.com/cgi-bin/readimage_v2/437914411" WIDTH=60 HEIGHT=45>
		</TD>
	</TR>
</TABLE>



<!-- end header include -->
<% if (newsId != null) { %>
	<%	for (int i=0;i<newsId.size();i++) { %>
			



<BR><a href="/JAABA/jsp/consumer/newsDetail.jsp?storyid=<%=newsId.elementAt(i)%>">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<b><%=URLDecoder.decode(newsTitle.elementAt(i))%></b></font>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><i> - <%=newsDate.elementAt(i)%></i></font>
<BR>

<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<%=URLDecoder.decode(newsSubTitle.elementAt(i))%> </font></A><BR>
<BR><BR>

<%}%>
<%}%>

thanx

mimsc 0 Junior Poster in Training
mimsc 0 Junior Poster in Training

Database records are returning strings as follows:

"Washington%20Report%3A%20Good%20Faith%20Estimate%20Mortgage%20Disclosures"

Is there a method that automatically translates those characters...or do I need to set it up?

Apparently the %20 is equal to a space

and the %3A is equal to ":"

thanx in advance

mimsc 0 Junior Poster in Training

Thanx for the replys

I closed the "<img space" tag and it worked in IE!!

thanx again

mimsc 0 Junior Poster in Training

http://www.palmer-realty.net/content/listdetail.html/89633726

-If you click on the green "Virtual Tour" button in the middle of the page...it gives a error

-This is working fine in Firefox

there's s function if you view source :

function win_up(winurl, winname,w,h) {
if (winname == null) winname = "calcs_win";
if (w == null) w = 500;
if (h == null) h = 500;
window.open(winurl, winname,"status,scrollbars,resizable,width=" + w + ",height=" + h);
}

Im a java programmer so im not sure whats really the cause of this...any help would be much appreciated

mimsc 0 Junior Poster in Training

I basically when I hit the "submit...I wanna go to that page....and have have all the rendered html from the page I was just on in a string so I can pass to that function

when I try to do that HTTP stream it wipes the page clean...thats the problem

mimsc 0 Junior Poster in Training

Is that link accessible via the browser? Since a server error has occurred, it might pay off to see the server log for more details.

BTW, I think you are better off using a free reporting tool like Jasper Reports to create reports rather than use the JSP of your very own application. Also, moving all this business code in a separate class which would be called by the servlet would be a wise move.

nah that link is not accesible via the browser...the log's tellin me Im getting a null from that page im trying to read from because its a form that requires parameters passed to it once accessed.....so I know what the problem is.....I just dont know how to get around it

mimsc 0 Junior Poster in Training

hey thanx for the response....check me out this what I got:

I got a form called "homeSellerReport1.jsp"..that has a submit that goes to this page:

<%@ page language="java" %>
<%@ page import="trader.webservices.util.Utils" %>
<%@ page import="trader.webservices.util.EmailSender" %>
<%@ page import="trader.webservices.data.UserDataVO" %>
<%@ page import="trader.webservices.data.UserInfoDAO" %>
<%@ page import="trader.webservices.data.AgentInfoDAO" %>
<%@ page import="java.io.DataOutputStream" %>
<%@ page import="java.io.FileOutputStream" %>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>
	
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
 <% 
 	UserDataVO userData = null;
    
 	String username = request.getParameter("username");
	String password = request.getParameter("password");
	String format = "txt";
 
	//String domainName = UserInfoDAO.removeHostRedirection(request.getServerName());
	
	String adminServer = request.getServerName();
	String javaAdminServer = request.getServerName();
	
	 if (request.getServerName().equals("localhost") || request.getServerName().startsWith("199")) {
			adminServer = "cpanel.homes.com";
			javaAdminServer = "localhost:8080";
	 }
	
			userData = UserInfoDAO.getUserInfo(username);
	
	//String address = "suggestaservice@agentadvantage.com,support@agentadvantage.com";
	String emailTo = request.getParameter("emailTo");
			
			
	URL httpUrl  = new URL("http://" + javaAdminServer + "/JAABA/jsp/cpanel/homeSellerReport1.jsp");
	InputStream fis  = httpUrl.openStream();
                byte[] bytes = new byte[fis.available()];
	
			
                fis.read(bytes);
                String strFileContent = new String(bytes);
			

	String msgBody = "Attached is the homeseller report you requested.";
	EmailSender emailSender = new EmailSender();
	emailSender.sendMailWithAttachment(emailTo,"web@homes.com","HomeSeller Report from Control Pane, Test",msgBody,strFileContent,format);
   
   %>

but im getting this error

java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/JAABA/jsp/cpanel/homeSellerReport1.jsp

mimsc 0 Junior Poster in Training

I have a jsp...I need to read in the generated html fron the jsp to a string buffer I can use in a mail method

how do u do that?

test.jsp

mimsc 0 Junior Poster in Training

nah I mjeant java...but I found out


thanx

request.getHeader("user-agent")

mimsc 0 Junior Poster in Training

attachment to message body? ...a little confused as to how to do that

mimsc 0 Junior Poster in Training

Sup fellas...another question..how Can I pass my jsp as the contents of a email message.

The way we send email around here is we set the parameters of a form into a DB table and a cron job sends the emails out

String address= "suggestaservice@agentadvantage.com"        String name = request.getParameter("name");
	String accountName = userData.getAcctName();
	String email = request.getParameter("email");
	String description = request.getParameter("description");
	String benefit = request.getParameter("benefit");
   
	
	//This is the body of the email
	String message = "Enhancement suggestion from:" + "\n\n";
	message += "Name: " + name + "\n";
	message += "Email: " + email + "\n";
	message += "Account: " + username + "\n\n";
	message += "Description: " + description + "\n\n";
    message += "Benefit: " + benefit;
	
   OutgoingMessage msg = new OutgoingMessage();
   msg.setFromAddr(email);
   msg.setFromName(name);
   msg.setToAddr(address);
   msg.setSubject("Preferred Pages Enhancement Suggestion");
   msg.setContent(message);
   msg.send();

any suggestions on how to set a whole form as the "message"

thanx

mimsc 0 Junior Poster in Training

request.getHeader("User-Agent"

thanx man

mimsc 0 Junior Poster in Training

I did a google search and found that PHP uses:

$_SERVER, which would give the following result, should I visit a page:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16

is their any functionality in java that will do the same??

thanx

mimsc 0 Junior Poster in Training

I did a google search and found that PHP uses:

$_SERVER, which would give the following result, should I visit a page:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16

is their any functionality in java that will do the same??

thanx

mimsc 0 Junior Poster in Training

thanx for the reply...I threw the vector into a string array instead

mimsc 0 Junior Poster in Training

Hey Fellas...Im getting this error on a "select box"...im trying to parse some info:

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method indexOf(java.lang.String)
location: class java.lang.Object

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method indexOf(java.lang.String)
location: class java.lang.Object

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method subString(java.lang.String,java.lang.String)
location: class java.lang.Object

============================
jsp:

<INPUT TYPE="hidden" NAME="username"VALUE="<=username>"/>
<INPUT TYPE="hidden" NAME="password" VALUE="<%=password%>"/>
<div>
<fieldset class="column box4fade">
<h4>Home Seller's Report</h4>
<p class="marginTopBump4">Please select a listing to generate a homeseller's report for and click "Proceed."
</p>
<div class="marginTopBump4 width13">
<select name="business_state" class="fullBox3">
<%
    for (int i=0;i<homeList.size();i++) {
    %>
                           	
<option value="<%=(String)homeList.elementAt(i).subString((String)homeList.elementAt(i).indexOf("("),(String)homeList.elementAt(i).indexOf(")")+1)%>"><%=(String)homeList.elementAt(i)%></option>


<%   
}
%>
                           	
</select>

can somebody tell me where Im going wrong I tried casting the Vector to a string...

thanx

mimsc 0 Junior Poster in Training

Hey Fellas...Im getting this error on a "select box"...im trying to parse some info:

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method indexOf(java.lang.String)
location: class java.lang.Object

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method indexOf(java.lang.String)
location: class java.lang.Object

PWC6197: An error occurred at line: 88 in the jsp file: /jsp/cpanel/HomeSellerList.jsp
PWC6199: Generated servlet error:
string:///HomeSellerList_jsp.java:147: cannot find symbol
symbol : method subString(java.lang.String,java.lang.String)
location: class java.lang.Object

============================
jsp:

<INPUT TYPE="hidden" NAME="username"VALUE="<=username>"/>
<INPUT TYPE="hidden" NAME="password" VALUE="<%=password%>"/>
<div>
<fieldset class="column box4fade">
<h4>Home Seller's Report</h4>
<p class="marginTopBump4">Please select a listing to generate a homeseller's report for and click "Proceed."
</p>
<div class="marginTopBump4 width13">
<select name="business_state" class="fullBox3">
<%
    for (int i=0;i<homeList.size();i++) {
    %>
                           	
<option value="<%=(String)homeList.elementAt(i).subString((String)homeList.elementAt(i).indexOf("("),(String)homeList.elementAt(i).indexOf(")")+1)%>"><%=(String)homeList.elementAt(i)%></option>


<%   
}
%>
                           	
</select>

can somebody tell me where Im going wrong?

thanx

mimsc 0 Junior Poster in Training

Hey fellas, I need some help doing on action changes

This is what I got. I have a loop that has the form name "autoEmailRedirect"

<form name="autoEmailRedirect" method="post"  action="autoEmailContact.jsp">
              <td valign="top" class="paddingLeft10 paddingTop9">
<div class="paddingBottom2 boldFont paddingTop20"><%=(String)autoName.elementAt(i)%></div>
</td>
<td class="paddingTop9 paddingLeft" valign="top">
<div class="paddingBottom2 paddingTop20"><%=(String)autoEmail.elementAt(i)%></div>
</td>
<td class="paddingLeft11 paddingTop9 paddingBottom13 width66" valign="top">
<select name="actionChoice" size="1">
<option value="1">Get Details about this customer</option>
<option value="2">E-mail Username/Password to customer</option>
<option value="3">E-mail link to Login page to customer</option>
<option value="4">Un-subscribe this customer</option>
</select>
<input type="submit" name="method" value="Go" onClick="javascript:doCustomRedirect();" class="butn smallbutn3 last"> 
<input type="hidden" name="email" value="<%=(String)autoEmail.elementAt(i)%>"/>
<INPUT TYPE="hidden" NAME="username" VALUE="<%=username%>"/>
<INPUT TYPE="hidden" NAME="password" VALUE="<%=password%>"/>
</td>
</form>

So if it has 3 instances...it prints out 3 times.


Now the javascript I have is

function doCustomRedirect()
	{
  var frm = document.forms["autoEmailRedirect"];
    if(frm.actionChoice.value == "1")
  {
    document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/autoEmailContact.jsp'; 
    document.forms["autoEmailRedirect"].submit();
  }
  if (frm.actionChoice.value == "2")
  {
    document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/cp-ecomm.jsp'; 
    document.forms["autoEmailRedirect"].submit();
  }
   if (frm.actionChoice.value == "3")
  {
    document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/changeAccount.jsp'; 
    document.forms["autoEmailRedirect"].submit();
  }  
  if (frm.actionChoice.value == "4")
  {
    document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/autoContactDelete.jsp'; 
    document.forms["autoEmailRedirect"].submit();
  }
}

This doesnt seem to be working at all..it goes to the page "autoEmailContact.jsp". no matter what option I choose

now If I do " document.forms[0].action"

I can get the 1st form to work...but the other 2 dont work


..and Im guessing because all the forms have the same name and it doesnt know which one to access????

Help a brotha out

thanx

mimsc 0 Junior Poster in Training

btw...thanx for the method..it worked buddy!!

mimsc 0 Junior Poster in Training

no joke...I love this place..I havent used it in months, but when I did yesterday..I got like 4-5 positive responses...google is cool...but this is a more refined a focused search for help

mimsc 0 Junior Poster in Training

why google when you have daniweb?

mimsc 0 Junior Poster in Training

Thanx for the help yesterday..I was able to break down the string from my database:

('MCKINNEY','TX'),('ALLEN','TX'),('ANNA','TX')

using:

String strInput = userData.getMhtCityList();
String strProcess=null;
String strOutputs[]=null;
if(strInput!=null){
strProcess=strInput.substring(1,strInput.length()-1);
System.out.println(strProcess);
strOutputs=strProcess.split("\\'\\),\\(\\'");
}

worked like a charm

only problem now is those damn apostophies

'MCKINNEY','TX
ALLEN','TX
ANNA','TX'

any suggestions on stripping out the apostrophies out the array?

thanx

mimsc 0 Junior Poster in Training

thank you all for the suggestions..I just got in and will try them out...good day to you all!!

mimsc 0 Junior Poster in Training

Hello all I have a string Im getting back from the database as follows:

('MCKINNEY','TX'),('ALLEN','TX'),('ANNA','TX')

I need to break it down and drop into an array
'MCKINNEY','TX'
'ALLEN','TX'
'ANNA','TX'

..normally I get multiple records and just drop the resultSet into a Vector and do "elementAt(i)" to display, but I never messed with a string like so

any suggestions?

I was thinking using replaceAll

for (String s : input.split("),(")) {
     System.out.println(s.repalceAll("(", "").replaceAll(")", ""));
}

that dont work...

mimsc 0 Junior Poster in Training

unfortunately this is all I get back from my compiler:.....yeah it sucks I know

myprops.c: In function `my_setupPropertyCursor':
myprops.c:10931: error: called object is not a function

mimsc 0 Junior Poster in Training

Hello, I'm normally the Java programmer here, but we got some old stuff running Pro*C.....anyway this is my error:

myprops.c: In function `my_setupPropertyCursor':
myprops.c:10931: error: called object is not a function

Here's the code:

/*================================================================
Name: mylibprops.c

Compile myprops to include this code.
10/29/04 -- MG -- Convert to use the search summary table.
=================================================================== */

#include <stdlib.h>
#include <math.h>
#include <homesland.h>
#include <htmllib.h>
#include <util.h>
#include <strutil.h>

#include <sqlca.h>
#include <oralib.h>
#include <datalib.h>

#include "props.h"

void my_setupPropertyCursor(const char * userId) {
     
	int startmeup = 0;
    int endmeup = 0;	
    char *escapedUserId = NULL;

    /*Take care of a reduced result set for speed.*/
  startmeup = 0;
  endmeup = BARE_LISTINGS_PER_PAGE;

  if (wf_filled("pageclicked")) {
  	endmeup = BARE_LISTINGS_PER_PAGE * atoi(wf("pageclicked")); 
	startmeup = endmeup - BARE_LISTINGS_PER_PAGE;
  } 
	
	
	
	
	Olen(sql_stmt) = Olen(sql_count_stmt) = 0;
    Ostr(sql_stmt)[0] = Ostr(sql_count_stmt)[0] = '\0';
	
    escapedUserId = escapeSQL(userId);    /** Remember to free this when we're done! */
    /** if (!escapedUserId) escapedUserId = userId;	We should probably bail, but we'll try to soldier on... */
 
  /*  printf("<!--- 31 mylibprops Hope this works --->");  */
    snprintf(Ostr(sql_stmt), sizeof(sql_stmt.arr), 
	    
		
		"SELECT b.state_code,\n"
		"   INITCAP(b.city) city,\n"
		"   b.listing_id,\n"
	    "	b.street_number||DECODE(b.street_number, NULL, '', ' ')||b.street_name,\n"
	    "	LTRIM(TO_CHAR(DECODE(b.list_price,0,NULL,b.list_price),'L99G999G999')),\n"
	    "   b.list_price PRICE,\n"
		"   b.bedrooms,\n"
		"   b.square_feet,\n"
		"   b.full_baths,\n"
	    "	b.half_baths,\n"
		"   b.three_quarter_baths,\n"
		"   NVL(b.year_built, 0),\n"
	    "   b.lot_size,\n"
		"   0 lot_size_units,\n"
	    "   b.floors,\n"
		"   b.listing_arch_style_code,\n"
		"   INITCAP(RTRIM(b.listing_arch_style_desc)) otherstyle,\n"
		"   b.property_type_code,\n"
	    "   '',\n"
		"   nvl(b.sold,' '),\n"
		"   INITCAP(RTRIM(b.listing_arch_style_desc)),\n"
	    "   b.caption_summary,\n"
		"   (b.list_price * -1),\n"
	    "   DECODE(b.pp, NULL, 0, 1) pplisting,\n"
	    "   DECODE(b.oem,NULL,0,'HCPP',0,'BHG',0,1) ppoem,\n"
	    "   NVL(b.actual_city, b.city),\n"
	    "	NVL(b.actual_state_code, b.state_code),\n" …
mimsc 0 Junior Poster in Training

Hi im new to perl..I normally code java...but the boss got me trying to fix this issue...

Anyway,we get a news feed that comes in as an xml file...this feed now requires "basic HTTP authentication"...the old feed didint require this , so there was nothing implemented in the code, ...anyway this is the code that's giving me the error..the feed people sent me a username and password....how and where should I implement it??....thanx in advance

my $article_xml_url = $article->getElementsByTagName('XMLPAGEURL')->item(0)->getFirstChild->getNodeValue;
                my $req = HTTP::Request->new( GET => $article_xml_url );
                $req->header('Accept' => 'text/xml');
                my $res = $ua->request($req);

                $res->status_line =~ m/^(\d\d\d) (.*?)$/;
                ($status_code,$status_message) = ($1, $2);
                if ( ! $res->is_success ) {
                        $errors = "Error fetching news article ($article_xml_url) from XML newsfeed: " . $res->status_line . "\n";
mimsc 0 Junior Poster in Training

Ok that looks simple..but what about if I have a input box that asks for the email address rather thatn being hardcoded into the action field

like:

<INPUT TYPE="SUBMIT" NAME="finish" VALUE="EMAIL"> To: <INPUT TYPE="TEXT" NAME="emailTo" VALUE="">

mimsc 0 Junior Poster in Training

Can anyone see it..I can't find it

<%
	RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/ErrorPage.jsp");
	
    UserDataVO userData = null;
    
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    
    boolean loginOkay = false;
    boolean trialOkay = true;
	boolean pageError = false;
	
	boolean hasBlanks = false;
	
	String menuType = null;
	
	String adminServer=request.getServerName();
	String javaAdminServer=request.getServerName();
	
	if (request.getServerName().startsWith("localhost") || request.getServerName().startsWith("199")) {

		adminServer = "zeus.homes.com";
		//for redirects, we need apache

		javaAdminServer = adminServer + ":8080";
	} else if (request.getServerName().equals("zeus.homes.com")) {
		adminServer = "zeus.homes.com";
		javaAdminServer = adminServer + ":8080";
	} else if (request.getServerName().startsWith("atprod")) {
		//adminServer = "cp";
		adminServer = "atprod.homes.com";  //atprod.homes.com  original 10/31/07
		//for redirects, we need apache
		javaAdminServer = javaAdminServer + ":8080";  // commented out originally. 10/31/07 
	}
	
	if ((username != null) && (password != null)) {
		loginOkay = UserInfoDAO.verifyLogin(username,password);
		if (loginOkay) trialOkay = UserInfoDAO.checkTrialOkay(username);
	}
	
	if (loginOkay && trialOkay) {
		try{
			/**
			* Get accountInfo based on accountName
			*/
			if (username != null) {
				userData = UserInfoDAO.getUserInfo(username);
			}
		}catch(Exception e){
			request.setAttribute("pageError","An error occured trying to log into control panel.");
			dispatcher.forward(request, response);
		}
	}
%>
mimsc 0 Junior Poster in Training

Hi, I'm basically just trying to submit this whole page into an email when I press submit at the bottoM...any suggestions?

<%@ page language="java" %>
<%@ page import="trader.webservices.util.Utils" %>
<%@ page import="trader.webservices.data.UserInfoDAO" %>
<%@ page import="trader.webservices.data.UserDataVO" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>





	<%
	
	
	String theAcctName = UserInfoDAO.getAcctFromAgentId(request.getParameter("agentId"));
	
	String username = theAcctName;
	
	UserDataVO userData = null;
	userData = UserInfoDAO.getUserInfo(username);
	
	
	
	Date date = new Date();
	SimpleDateFormat sdf;
	sdf = new SimpleDateFormat("E, MMM. dd, yyyy");
	%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Seller proof template 1</title>
</head>
<body>
Use this page to proof reports before you send them. Email or printed reports will appear exactly as they do in the box below.<BR><BR>
<table width="675" border="0" cellspacing="0">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0">
        <tr> 
          <td width="13%" align="center" valign="middle" rowspan="2"><IMG SRC="http://cdn-317.homes.com/c1/cgi-bin/readimage/173533317" WIDTH="90" HEIGHT="67" BORDER="0"></td>
          <td width="41%" rowspan="2" align=center> 
            <p><font face="Arial,Helvetica,Sans-Serif" size="4"><b><%=userData.getName()%></b><br>
              <font size="2"><%=userData.getStreet()%> <br>
              <%=userData.getCity()%>, <%=userData.getState()%> <%=userData.getZip()%><br>
              <%=Utils.splitPhone(userData.getPhone(),1) + "-" + Utils.splitPhone(userData.getPhone(),2) + "-" + Utils.splitPhone(userData.getPhone(),3)%><br>
              <A HREF="<%=userData.getEmail()%>"></A></font><%=userData.getEmail()%></font><br>
              <a href="http://<%=userData.getAcctName()%>" target="_new"></A></font><%=userData.getAcctName()%></font></p>
          </td>
          <td width="45%" align="center" valign="middle"><IMG SRC="http://cdn-798.homes.com/c1/cgi-bin/getimage/06912798" BORDER="0" HEIGHT="65"></td>
        </tr>
        <tr>
          <td width="45%" align="center" valign="middle"><font face="Arial,Helvetica,Sans-Serif" size="2">            <b>Virtual Office - Southern BrokerDemo</b><br>
            333  main street   <br>
            Your Hometown, FL 33333</font></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0">
        <tr> 
          <td width="3%" align="left" valign="top">&nbsp;</td>
          <td width="56%" align="left" valign="top"><font face="Arial,Helvetica,Sans-Serif" size="2"><br>
            <br>
            <%=request.getParameter("location")%></font></td>
          <td align="center" valign="middle" width="45%"><font face="Arial,Helvetica,Sans-Serif" size=2><%=sdf.format(date)%>"</font></td>
        </tr>
        <tr> 
          <td width="3%" align="left" valign="middle"> 
            <p>&nbsp;</p>
            </td>
          <td width="56%" align="left" valign="middle"> 
            <p><font face="Arial,Helvetica,Sans-Serif" size="2">Dear 
              ,<%=request.getParameter("homeseller")%><br>
              <br>
              In the month of October 2007 I received the<br>
              following information requests in regards to:</font></p> …
mimsc 0 Junior Poster in Training

ha..no luck i guess

mimsc 0 Junior Poster in Training

any suggestions...my "weatherState" value doesnt seem to be passing over:

1st jsp:

<%
Vector theStates = WeatherDAO.getWeatherStates();
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

</script>

<body>




<TR bgColor="#ffffff"><TD COLSPAN="2">
<TABLE CELLPADDING="3" CELLSPACING="2">
<TR><TD>

</FONT></CENTER><BR>
<BR>
<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
<TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
</TD></TR>
</TABLE>
<HR SIZE="3" NOSHADE>
<font size=+1>Choose a state and press continue</font><br>
<TR><TD> 
<center>

<form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  
<label for="weatherState">State:</label>

<select name="weatherState" >

<% for (int i=0; i< theStates.size(); i++) {  %>

<OPTION VALUE><%=theStates.elementAt(i)%></OPTION>



<% 
}
%>

2nd jsp:

<%
System.out.println("error...: "+request.getParameter("weatherState"));
String sValue = request.getParameter("weatherState");
Vector theCities = WeatherDAO.getWeatherCities(sValue);
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>



<body>




<TR bgColor="#ffffff"><TD COLSPAN="2">
<TABLE CELLPADDING="3" CELLSPACING="2">
<TR><TD>

</FONT></CENTER><BR>
<BR>
<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
<TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
</TD></TR>
</TABLE>
<HR SIZE="3" NOSHADE>
<font size=+1>Select the State and City for which you would like to receive weather information.</font><br>
<TR><TD> 
<center>


<label for="weatherCity">City:</label>

<select name="weatherCity" > 

<% for (int i=0; i< theCities.size(); i++) {  %>

<OPTION VALUE=<%=theCities%>> <%=theCities.elementAt(i)%> </OPTION>

<% 
}
%>
mimsc 0 Junior Poster in Training

Hi I want to populate my second drop-down menu based off of the value selected on my first drop down. Is there a function or a way of doin g this...

P.S my code is in a JSP:

<%
Vector theStates = WeatherDAO.getWeatherStates();
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>



<TR bgColor="#ffffff"><TD COLSPAN="2">
<TABLE CELLPADDING="3" CELLSPACING="2">
<TR><TD>

</FONT></CENTER><BR>
<BR>
<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
<TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
</TD></TR>
</TABLE>
<HR SIZE="3" NOSHADE>
<font size=+1>Select the State and City for which you would like to receive weather information.</font><br>
<TR><TD> 
<center>


<label for="weatherStat">State:</label>

<select name="weatherStat" id="States">
<% for (int i=0; i< theStates.size(); i++) {  %>

<OPTION VALUE=<%=theStates%>> <%=theStates.elementAt(i)%> </OPTION>

<% 
}
%>
</select>		

>


</TD></TR>
</center>
<TR><TD> 
<br>
<br>
<center>

<label for="weatherCity">City:</label>
	<select name="weatherCity" id="Cities">
<% 	

	
Vector theCities = WeatherDAO.getWeatherCities();// <<this is wher I need to pass the selected value

%>
<OPTION VALUE= </OPTION>

<% 
}
%>



						
</select></TD></TR>
mimsc 0 Junior Poster in Training
<select name="weatherStat" id="States">
<% 
			
			
			try {
			Connection connection = DataBaseConnectionManager.getConnection();
			String sqlQuery = "SELECT distinct state FROM ols_weather_current ORDER BY 1 asc";
			ResultSet rst2;
			PreparedStatement pstmt;
			pstmt = connection.prepareStatement(sqlQuery);
			rst2 = pstmt.executeQuery(sqlQuery);
			while (rst2.next ()) {
				
			<option value=rst2.getString("state")></option>
			}
			
			rst2.close();
            pstmt.close();
			} 
            
		catch (Exception e) {
			e.printStackTrace();
            }
	
	%>


</select>

having trouble...any suggestions?

mimsc 0 Junior Poster in Training

I have an idea how to do this, but never did it before

heres my code:

<label for="weatherCity">City:</label>
<select name="weatherCity" id="Cities">
<option value="0"> </option>

here's my query:

SELECT distinct state
FROM ols_weather_current
ORDER BY 1 asc;

Connection connection;
PreparedStatement pstmt;
ResultSet rst2;


try { // execute the query
connection = DataBaseConnectionManager.getConnection();
String sqlQuery = "SELECT distinct state FROM ols_weather_current
    ORDER BY 1 asc";
pstmt = connection.prepareStatement(sqlQuery);
ResultSet rst2;

rst2 = pstmt.executeQuery(sqlQuery2);

%>
<tr>
<td> State:
<select>;
<% while (rst2.next ()) {

}  ("</select>");
%>

Im not sure how to set up the while statement...any help would be appreciated


thanx

mimsc 0 Junior Poster in Training

appreciate the help Ezzaral...good lookin playa!

mimsc 0 Junior Poster in Training

thanx man

mimsc 0 Junior Poster in Training

Check your parenthesis on the if() statement.

ok I opened up the if:

<div id="contactInfo">
  <%
	if (userData.getName().charAt(0)!='<' || userData.getName().charAt(userData.getName().length()-1)!='>' ) {
  %>    

	<span> <%=userData.getName()%> &#8226;</span>

if I put "<sample" for the name...nuthing shows up

but if I put"sample>"..it still displays the string

mimsc 0 Junior Poster in Training

getting illegal start of expression and ';' expected...Im sure it's something small..or I set it up wrong....take a look

<div id="contactInfo">
  <%
	if (userData.getName().charAt(0)!='<') || (userData.getName().charAt(userData.getName().length()-1)!='>' ) {
  %>    

	<span> <%=userData.getName()%> &#8226;</span>
<%}

%>
mimsc 0 Junior Poster in Training

thanx

mimsc 0 Junior Poster in Training

alright...let me check that out..I'll be back to let u know

mimsc 0 Junior Poster in Training

trying to see if the last character is a '>'......any suggestions

I already know how to check for the character


heres what I got

if (userData.getName().charAt(0)!='<' ) {


thank

mimsc 0 Junior Poster in Training

Wsup..basically I have a html file saved in another folder in Eclipse..I want to call a jsp and once I call it...I want the html code to show up...here's what I have

"cp-termsofUse.jsp"

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Terms of Use</title>
</head>
<body>

<jsp:include page="termsofUse.html"  flush="true"/>
</body>
</html>

when I call the file..I get a blank page....any suggestions would be greatly appreciated

thanx

mimsc 0 Junior Poster in Training

So my user has successfully logged into their page...I have a "home" button link that I want to simply go back to this same page....when they press it...it takes them to the login screen....any suggestions??

here's my code snippet

<li class="first"><a href="cp-newmenu.jsp" target="_new" class="on">Home</a></li>

thanx in advance