Jitesh Ranavaya

Greenhorn
+ Follow
since Sep 09, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jitesh Ranavaya

I think the line:

Store store = s.getStore("imap");

should read...

Store store = s.getStore("pop3");

but now I get these two errors at different times...

javax.servlet.ServletException: [IN-USE] account is locked by another session or for maintenance, try again.

and....

class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
19 years ago
I decided it would be easier to use IMAP, since I'm only interested in sending emails. My test program is shown below, am pretty sure somethings wrong...I just dont know what. I get the following error:

java.net.ConnectException: Connection timed out: connect

Heres the code:


I'm in desperate need for this to work....somebody please help.
19 years ago
Am pretty sure it does allow it, because i'm following an example program from a book. But my program doesn't work for some reason.

Does anyone have any other ideas of how I can efficienty send emails from tomcat?
19 years ago
Hi, I'm trying send an email via tomcat using javamail. But I get the following error:

javax.servlet.ServletException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html


I did go to the yahoo url above, but couldn't find any help.

Heres my code:


Please somebody help!
19 years ago
William, thats what I meant, an empty string.
How do I check that all of the text boxes are filled in and not left blank?
There must be an efficient way of doing it.
19 years ago
JSP
Hi, I am writing a 'form' where I need to check if text boxes are null (empty), before the next page is displayed. Here is my code so far:


<%@page import="reg.Register"%>
<jsp:useBean id = "newcust" class="reg.Register" scope ="session"/>

<jsp:setProperty name ="newcust" property="*" />



<% if(request.getParameter("Continue")!=null){

%>

<%!String lname="";%>



<%
if (request.getParameter("lastName")==null){

lname = "Please enter last name";
response.sendRedirect("Register1.jsp");


}
%>


<jsp:forward page="Register2.jsp"/>
<%}%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>

<span id="Layer1" style="position:absolute; left:610px; top:15px; width:358px; height:23px; z-index:10">
<div align="right"><font color="#0000FF" size="3" face="Lucida Console"><a href="FrontPage.jsp">Home</a>
<a href="SignIn.jsp">Sign In</a> <a href="SignOut.jsp">Sign Out</a> <font color="#000000">Register</font>
Help</font></div>
</span>
<div id="Layer2" style="position:absolute; left:9px; top:82px; width:137px; height:83px; z-index:11">
<table width="146" border="0" cellpadding="2">
<tr>
<td><font color="#0000FF" size="3" face="Lucida Console">My Bazaar</font></td>
</tr>
<tr>
<td><font color="#0000FF" size="3" face="Lucida Console">Browse</font></td>
</tr>
<tr>
<td height="20"><font color="#0000FF" size="3" face="Lucida Console"><a href="Sell.jsp">Sell</a></font></td>
</tr>
<tr>
<td><font color="#0000FF" size="3" face="Lucida Console">Search</font></td>
</tr>
</table>
</div>

<div id="Layer3" style="position:absolute; left:785px; top:509px; width:96px; height:17px; z-index:15"><font color="#FF0000" face="Lucida Console">*</font><font color="#FF0000">required
fields</font></div>
<form method = post action = "Register1.jsp">
<div id="Layer5" style="position:absolute; left:191px; top:126px; width:351px; height:255px; z-index:14"> <form name="form1" method="post" action="">
<table width="342" height="389" border="0" cellpadding="2">
<tr>
<td width="63"><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Title
: </font></td>
<td width="145"><font face="Lucida Console">
<select name="title">
<option>Mr</option>
<option>Mrs</option>
<option>Ms</option>
</select>
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Surname
: </font></td>
<td><font face="Lucida Console">


<%=lname%>


<input name="lastName" type="text" id="lastName">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Firstname
: </font></td>
<td><font face="Lucida Console">
<input name="firstName" type="text" id="firstName">
</font></td>
</tr>
<tr>
<td height="52"><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Street
Address : </font></td>
<td><font face="Lucida Console">
<input name="addressLine1" type="text" id="addressLine1">
</font></td>
</tr>
<tr>
<td><font face="Lucida Console"> </font></td>
<td><font face="Lucida Console">
<input name="addressLine2" type="text" id="addressLine1">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">City
: </font></td>
<td><font face="Lucida Console">
<input name="city" type="text" id="city">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">County
: </font></td>
<td><font face="Lucida Console">
<input name="county" type="text" id="county">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Postcode
: </font></td>
<td><font face="Lucida Console">
<input name="postCode" type="text" id="postCode">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Phone
number :</font></td>
<td><font face="Lucida Console">
<input name="phone" type="text" id="phone">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Country
: </font></td>
<td><font face="Lucida Console">
<input name="Country" type="text" id="Country">
</font></td>
</tr>
<tr>
<td><font color="#FF0000" face="Lucida Console">*</font><font face="Lucida Console">Date
of Birth : </font></td>
<td><font face="Lucida Console">
<input name="dob" type="text" id="dob">
</font></td>
</tr>
<tr>
<td><font face="Lucida Console"> </font></td>
<td><font face="Lucida Console">
<input name="Continue" type="submit" id="Continue" value="Continue">
</font></td>
</tr>
</table>
</form>
</div>
<div align="right"></div>
<span id="Layer9" style="position:absolute; left:613px; top:33px; width:172px; height:38px; z-index:9"><img src="l.jpg" width="389" height="48"></span>
<div align="right">
<p> </p>
<p align="left">  </p>
</div>
</body>
</html>

The above does not work (and you can probably tell that am new to jsp).
lname is the attribute that I want to display the error message, obviously above the lastName text box. The problem I am having is that I dont know how to stucture the if (if-else) statements.

Thanks for the help in advance
Jitesh
19 years ago
JSP
Thanks for trying to help mate, but am still having the same problem
19 years ago
JSP
Hey, I just tried doing that, but it still comes out with the same error.
Have I got the files in the right places?
As far as I know, all class files go in the "WEB-INF" folder, and the jsp file has to be outside it.
E.g.
"C:\CARTAPP\jsp" is where email_address.jsp is.
"C:\CARTAPP\jsp\WEB-INF\classes\cust" is where the Customer.class file is.
19 years ago
JSP
Hi guys, am new to jsp so hope you can help me out.
Am trying to link up a simple database with a bean, but am not too sure how to do this.

I keep getting the following error:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /jsp/email_address.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\cartapp\jsp\email_address_jsp.java:7: package cust does not exist
import cust.*;
^
C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\cartapp\jsp\email_address_jsp.java:43: package cust does not exist
cust.Customer newcust = null;
^



An error occurred at line: 2 in the jsp file: /jsp/email_address.jsp

Generated servlet error:
C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\cartapp\jsp\email_address_jsp.java:45: package cust does not exist
newcust = (cust.Customer) pageContext.getAttribute("newcust", PageContext.REQUEST_SCOPE);
^



An error occurred at line: 2 in the jsp file: /jsp/email_address.jsp

Generated servlet error:
C:\jakarta-tomcat-4.1.30\work\Standalone\localhost\cartapp\jsp\email_address_jsp.java:48: package cust does not exist
newcust = (cust.Customer) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "cust.Customer");
^
4 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)


I've placed email_address.jsp in C:\CARTAPP\jsp and the customer.class file in C:\CARTAPP\jsp\WEB-INF\classes\cust. When i run email_address.jsp on the server i get the above error.

Heres the email_address.jsp file for your convenience:
------------------------------------------------------------------
<%@page import="cust.*"%>

<jsp:useBean id = "newcust" class="cust.Customer" scope ="request"/>
<jsp:setProperty name = "newcust" property = "*"/>

<%newcust.createCustomer();%>

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Email Address</title>
</head>

<body>

<form method = post action = "email_address.jsp">

<table border="0" width="61%">
<tr>
<td width="20%">Email Address</td>
<td width="80%"><input type="text" name="email_address" size="20"></td>
</tr>
<tr>
<td width="20%">Password</td>
<td width="80%"><input type="text" name="password" size="20"></td>
</tr>
<tr>
<td width="20%"></td>
<td width="80%"><input type="reset" value="Reset" name="B2"><input type="submit" value="Submit" name="B1"></td>
</tr>
</table>
<p><br>
</p>

</body>

</html>

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

And heres the customer.java file:

import java.sql.*;

public class Customer{
private String email_address;
private String password;

public String getCustomerEmail(){
return email_address;
}

public void setCustomerEmail(String e){

email_address = e;
}


public String getCustomerPass(){
return password;
}

public void setCustomerPass(String p){

password = p;
}

public void createCustomer(){

Connection conn = null;
Statement st = null;
PreparedStatement pst;
//Resultset rs = null;

try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn=
DriverManager.getConnection("jdbc:mysql://localhost/cartapp");

st = conn.createStatement();
pst=conn.prepareStatement("insert into customer (Customer_ID,Email_Address,Password) "+" values (?,?,?)");
pst.setString(1,"NULL");
pst.setString(2,getCustomerEmail());
pst.setString(3,getCustomerPass());
pst.executeUpdate();
pst.close();
}

catch (Exception ex){
ex.printStackTrace();}

}

}
---------------------------------------------------------------------

Your help is very much appreciated,
Jitesh
[ September 09, 2004: Message edited by: Bear Bibeault ]
19 years ago
JSP