Anjali Ajwani

Greenhorn
+ Follow
since Jan 18, 2001
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 Anjali Ajwani

Hi,
The first part(requestdispatcher), I had done yesterday. How do I do the second one....sending the control to JSP after lapse of some seconds? Which package can I find this in?
Thanks,
22 years ago
I have a form in a JSP page which accepts several fields from the user. After entering these fields the user can select either "Add this vendor" or "Add Location for this vendor". If "Add this Vendor" is selected, the controller servlet will insert all these fields into the database.
Once the values are inserted in the database(executeUpdate() is done), the user should see a message saying "Insert successful" and also come back to this first JSP, so that he can enter "Location" now. How do I achieve this?
22 years ago
Hi,
Can anyone suggest a good beginner's XML Book for a person with Java experience??
Thanks,
Thanks Dale. This is what I was looking for.
22 years ago
How can I ensure that a class has only one instance?
22 years ago
Please add my name too. I am on Assignment 1(a).
Thanks,
Anjali

Sorry, I did not mention my attempt number which is 1.
[This message has been edited by Marilyn deQueiroz (edited March 26, 2001).]
23 years ago
I've been trying to install JRun on my machine for the past two days. Everytime it gives the same error message:
"The contents of this file cannot be unpacked. The executable you are attempting to run has been corrupted. Please obtain another copy of the file, verify its integrity, and try again."
I have downloaded every time from allaire's website and with two different login names at different times.
Does anyone have any advice?
Thanks,
.....Anjali.....
23 years ago
Hi Sunil,
Answer to some of your questions:
1) No, knowledge of servlets is not essential to being JSP. What you need to know is Java and HTML.
2) Install JRun from www.allaire.com. That is a good engine.
3) No idea.
4) JSP's tutorial at Sun's site.
5) Professional Java Server Programming is a good book, but that's for advanced learning. I haven't tried O'reilly book, but have read Core JSP by Damon Hougland and Aaron Tavistock, which is OK for beginners.
......Anjali.......
23 years ago
Hi Rob,
That's right. Uninstall JWSDK - it doesn't support all the features too. Java Web Server can be downloaded from sun's site for a period of 30 days. But this will also be removed from their site by May. For a month JWS is OK. You could try JRun instead. You can download it from www.allaire.com. It is a good engine.
......Anjali....
23 years ago
Hi Jenny,
Visit the site "http://www.sun.com/software/jwebserver/index.html". You might find something of interest w.r.t. JavaWebServer.
.........Anjali......
23 years ago
Hi Eric,
I hope I'm not late for the solution you're looking for. See if the following code helps you. w.r.t. Ajan's question, I think this answers them all.
/*
Servlet showing persistence across loads - a counter that doesn't have to start over whenthe server is shut down or the servlet is reloaded. The counter keeps count of the number of times the site has been visited.
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InitCounter extends HttpServlet {
int count;
public void init(ServletConfig config) throws servletException {
super.init(config);
//Try to load the initial count from the saved persistence state
//this fails the first time the servlet runs because the file doesn't exist
try{
FileReader fileReader = new FileReader("InitCounter.initial");
BufferedReader bufferedReader = new BufferedReader(fileReader);
String initial = bufferedReader.readLine();
count = Integer.parseInt(initial);
return;
}
catch (FileNotFoundException e) { }// no saved state
catch (IOException e) { } // problem during read
catch (NumberFormatException e) { }// corrupt saved state
//If no luck with the saved state(first time), check for an init parameter
//specifying the starting count.
String initial = getInitParameter("initial");
try {
count = Integer.parseInt(initial);
return;
}
catch (NumberFormatException e) { }
//default initial count of "0" --- if the above two fail
count = 0;
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
//code multithreaded access
int local_count;
synchronized(this) {
local_count = ++count;
if (count % 10 == 0) saveState();
}
out.println("Since loading, this servlet has been accessed " +
local_count + " times.");
}
public void destroy() { //destory method is called just once per servlet instance
saveState();
}
public void saveState() {
//save the accumulated count
try {
FileWriter fileWriter = new FileWriter("InitCounter.initial");
String initial = Integer.toString(count);
fileWriter.write(initial, 0, initial.length());
fileWriter.close();
return;
}
catch (IOException e) { } //problem during write
}
}
23 years ago
Email id: "anjali_ajwani@hotmail.com"
Thanks,

Originally posted by Navin Narayan:
Guys, like you all, I am also giving the Java Certification.
The Mughal Khalid exam is good but it does not give answers. So
I modified it a bit so that it displays answers too. If anyone is interested, you all can mail me.


Scrolling through result sets bi-directionally can be done with a JDBC 2.0 database driver, but cannot be done with a JDBC 1.x driver.
Anjali

Originally posted by bhupathiraju gayatridevi:
In a ResultSet can we search records from top to bottom and bottom to top at the same time and how. If so, is it faster than searching from one side.


Hi Rani,
Try this:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(<url>,<sid>,<password>);
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery(<query>);
while(rs.next())
{
int ctr = ctr + 1;
}
Anjali

Originally posted by Rani Mukherjee:
Hello,
How to get the no. of rows the table having in it? I am using oracle as database & JDBC-ODBC Bridge.
Thanx in advance
Rani


Hi,
I have to put page-wise scrolling of database records in my JSP code. Can someone help?
Thanks,
Anjali
23 years ago