RAJESH RASTOGI

Greenhorn
+ Follow
since Jan 20, 2002
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 RAJESH RASTOGI

hi guys,

Please help me in running a jsf program with database connectivity.

Thanks in advance

Rajesh
14 years ago
plz mention one more thing, where u r setting the classpath for mail n jaf api. u need to set the classpath for tomcat server in tomcat.bat in bin folder.
try this one n reply soon.
16 years ago
JSP
Dear,
u r getting the error for class 'MultiPartRequest' not found in http.utils.multipart package.
but for this class u need a different package com which consists all the files need to upload the files.
hope this will help u.
rajesh
16 years ago
hello,
store this image in a zip file and link the image to this zip file.
now when the user will click on the image to download the browser functionality will ask him to download or not.
hope this willl help u.
16 years ago
JSP
hello,
u can use one of both include directive or jsp:include.
<%@include file="" %>
or
<jsp:include page="" flush="true"/>
include directive includes the src file at compile time.
hope this will help u.
16 years ago
JSP
an inner class can be static in a block not in a method like u declaring a variable or method as static
16 years ago
JSP
hello,
u r using cursor.
so lock the table untill the operation is not getting completed.
16 years ago
JSP
hello,
use this driver provided by sun in Class.forName method in the following way -
Class.forName( "sun.com.JdbcOdbcDriver" )
hope it will help u
16 years ago
JSP
hello,
have u checked the input type for the button on which u r applying the onClick event.
if u have given input type submit change it to button.
now it will get work.
16 years ago
JSP
Dear Jeff Grant,
out is the defined variable of PrintWriter class in jsp. its scope is local n itz only in _jspService().
u r declaring a global method named blah().
so it's displaying the compile-time error.
hope this will help u.
16 years ago
JSP
Dear Nancy Johnson,
yahoo doesn't allow to use their smtp or pop mail addresss in free of cost. so u will have to change the both of these two addresses.
n u can send mail by using the following code -
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class mailer
{
public static void main (String args[]) throws Exception
{
String smtpHost = "smtp.id.eth.net";
String from= "rajrastogi2k@yahoo.com";
String to= "rajrastogi2k@yahoo.com";
Properties props = System.getProperties();
props.put( "mail.smtp.host", smtpHost );
Session session = Session.getDefaultInstance( props, null );
session.setDebug( true );
MimeMessage message = new MimeMessage( session );
message.setFrom( new InternetAddress(from) );
message.addRecipient( Message.RecipientType.TO, new InternetAddress(to) );
message.setSubject( "subject" );
message.setContent( "message", "text/html" );
Transport.send( message );
}
}
If it doesn't work, then change the smtp address n run this program.
Bye
this is the code without errors
but remember one thing while coding , do indenting with ur code for easy debugging n find out the compile-time errors.

/*
* UserIdFormTempBean.java
*
* Created on January 27, 2003, 2:18 PM
*/
package beans.userid;
/**
*
* @author surag
*/

import java.lang.*;
import java.io.*;
import java.sql.*;
import java.util.*;
public class UserIdFormTempBean implements Serializable {
private String userid;
private String pwd;
private Hashtable errors;
private String useridFromDB;
private String pwdFromDB;
//private int noOfAttempts;
public UserIdFormTempBean()
{
userid= "";
pwd="";
// noOfAttempts=0;
System.out.println("Bean Instantiated" + this.userid);
errors= new Hashtable();
}
public int validate()
{
int userIdErr=0;
int pwdErr=0;
int allErr=0;
userid= userid.trim();
pwd= pwd.trim();
if ( userid.equals(null)|| userid.equals(""))
{
errors.put("USERID","Invalid UserId ");
System.out.println("userid error");
userIdErr=1;
allErr=1;
}
if( userIdErr==0)
{
if(!validateUSERIDFromTable( userid))
{
System.out.print( " userid frm db error");
userIdErr=1;
allErr=1;
}
return userIdErr;
}
if (pwd.equals(null)||(pwd.equals("") ))
{
errors.put( "pwd", "Invalid PassWord");
System.out.println("pwd error");
pwdErr=1;
allErr=1;
}
if( pwdErr==0)
{
if(!validatePWDFromTable(pwd))
{
System.out.print( " PASSWORD frm db error");
pwdErr=1;
allErr=1;
}
return pwdErr;
}
if (userIdErr==0)
errors.put("userid","");
if ( pwdErr==0)
errors.put("pwd","");
return allErr;
}
public void setUserId( String USERID){
this.userid= USERID;
System.out.println(" USERID = "+USERID);
}
public void setPwd( String PWD){
this .pwd =PWD;
System.out.println( "PWD="+ PWD);
}
public String getUserid(){
return userid;
}
public String getPwd(){
return pwd;
}
private boolean validateUSERIDFromTable(String userid){
boolean vuseridOK= true;
Connection con = null;
Statement stmt= null;
ResultSet rs= null;
String qry = "SELECT LOGIN_ID, PWD FROM SECURITY_USERS WHERE LOGIN_ID= " +userid;
System.out.println("qry in vvalidateUSERIDFromTable="+ qry);
try {
Driver myDriver= (Driver)Class.forName("xxxx.jdbc.pool.Driver").newInstance();
con= myDriver.connect("jdbc:xxxx ool:xxxPool", null);
stmt=con.createStatement();
rs=stmt.executeQuery(qry);
if (rs.next())
{
System.out.println("valid userid="+ qry);
}
else
{
errors.put("userid", " Invalid UserID, Please check USERID and try again");
vuseridOK = false;
}
rs.close();
stmt.close();
con.close();
} catch (Exception e){
System.out.println("Datebase connection error "+e );
}
return vuseridOK;
}
private boolean validatePWDFromTable( String pwd)
{
boolean vpwdOK= true;
Connection con = null;
Statement stmt= null;
ResultSet rs= null;
String qry = "SELECT LOGIN_ID, PWD FROM SECURITY_USERS WHERE PASSWORD= " +pwd;
System.out.println("qry in vvalidatePWDFromTable="+ qry);
try
{
Driver myDriver= (Driver)Class.forName("xxxx.jdbc.pool.Driver").newInstance();
con= myDriver.connect("jdbc:xxxx ool:xxxPool", null);
stmt=con.createStatement();
rs=stmt.executeQuery(qry);
if (rs.next())
{
System.out.println("valid userid="+ qry );
}
else
{
errors.put("userid", " Invalid PASSWORD, Please check PASSWORD and try again");
vpwdOK = false;
}
rs.close();
stmt.close();
con.close();
}catch (Exception e){
System.out.println("Datebase connection error "+e );
}
return vpwdOK;
}
}
16 years ago
JSP
u can get the real path on the server of the jsp file by using
application.getRealPath("jspfilename.jsp");
now u have the path of ur jsp file, now u can create the folder n upload the html files.
16 years ago
JSP
I m using tag library in jsp, but when i compile java file. i get errors class not found - JSPException, JSPTagException
I have servlet.jar which comes up with tomcat 4.0 means servlet 2.3 or jsp 1.2.
Kindly help me from where i can get the latest servlet.jar file to remove these errors.
Thanks in advance,
Rajesh
16 years ago
JSP
Hi,
I used this code in my program. but when i used GZipOutputStream. It displayed the download box on the client machine.
Plz help me how to send the fast output to the client.
Thanks in advance,
Rajesh
16 years ago
JSP