This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

vikinsa

Ranch Hand
+ Follow
since Apr 18, 2001
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 vikinsa

There is not much diffrenece in what you do for servlet-servlet communication and the servlet-jsp communication. Only thing you need to consider is the path and the port.

Originally posted by Sanjay, Lalwani:
HI
Is there any one who has solved problem of communicating info from servlet to jsp.
Cheers
Sanjay



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
The above code sample is good but for ms -access you need to use JDBC/ODBC driver. Com Driver is for mySQL.

Originally posted by shahzahid hussain:
i am connect to microsoft database(SQL Server Or Access)
with out using JDBC:ODBC
If any one Achive this task plese send me mail with script
at
thanx



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
Try this connection pooling. It is ready to use type and very effective...
Download the source code from
http://www.mcp.com/isbn/sourcecode/0672316005/source.exe
and then find the connection pooling.

Originally posted by mani dalal:
Hello Servlet /JDBC experts,
I need some urgent help regarding ConnectionPool .
I have created connection pool of max 15 connections in init()method of servlet.
I am creating a connection object from the pool and passing that object to a class trhough its constructor .This class uses the connection object and fetches the data and returns the same trhu a string object to the main servlet.
Problem here is that the connection used by another class is not getting released thru the'release connection' method of connectionpool trhu finally clause in the main servlet.Connections are stopped after 15 connections.
Can anyone help me for the saem.
public class servlet {
init(){connectionpool}
doget{
connection con=conpool.get....
someclass class=new someclass(con);
String r=class.str();
p.println(r)
}
finally(!con=null){conpool.releaseconnection)
}//doget over



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
In the same web root folder make two folders first for html and second for the jsp. keep the corresponding files in that. That is all. But you need to change the paths of the JSPs and HTML in your application.

Originally posted by v venkatesh:
Iam able to work with jsp when i kept my .html files and .jsp in the same folder.I want to have a separate folder to keep all my
.html and .jsp pages .how can i do.Can any body give me some ideas based on this situation?



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
That should not happen. I think there is a serious trouble with your presentation logic. Check the loops in the program.

Originally posted by karan, chopra:
hi folks,i have the following problem,wonder if anyone could help me out..
1.)in my servlet i execute a SQL query on one of the tables of my database,the query returns a couple of tables and stores the result in the resultset.then i display the result in my servlet.everything is fine till now..but when my query is run so that it returns some columns from 2 tables of my database then each value of the resultset is displayed 12 times on the servlet,ie,say each row is displayed a couple of times and not a single time which i want(because i am storing the different values of the resultset into different arrays)..why is this so..plz help....
thanks in advance
regards
karan



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
May be it is because the tomcat of yours has not created contet of that method file. Check that out first. Also you need to keep these kind of files in a specific directory of tomcat.

Originally posted by Honey Nanwani:
Howdy Folks,

I am using a Bean and calling a method in a JSP. Tomcat says method not found when its in the bean and its public.

Is this a bug with tomcat. Its driving me crazy. It works on one instance of Tomcat but not on another.

Any Ideas?
Thank you
Honey



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
Hi!,
That class of yours should be a java function which should return vector type. Now if that function class is in your calsspath you can call that in your servlet and get the returned Vector. Vector is all yours. Otherwise you'll have to try some things with serialization.

Originally posted by Ajit Kanada:
Hi
I have one class which has some vectors.I want these vectors to send to servlet.How can i do this.I tried with URLConnections...
Can anyone help me
AJit



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
You can try the follwing function for the conversion...(May be you'll have to modify this function.) This function is very robust and I have used it a thousand times.
public static String getDate(String scheduledDt)
{
String s;
s=scheduledDt;
s.trim();

System.out.println("Date : "+ s);
String yyyy = s.substring(0,4);
String mm = s.substring(5,7);
String dd = s.substring(8);
int int_year= Integer.parseInt(yyyy);
System.out.println("YYYY : "+ yyyy);
int int_day =Integer.parseInt(dd);
System.out.println("day : "+ dd);
int int_month=Integer.parseInt(mm);
System.out.println("month : "+ mm);
String mon = null;
//Date comaprison
if (int_month == 1)
{
mon = "jan";
}
else if (int_month == 2)
{
mon = "feb";
}
else if (int_month == 3)
{
mon = "mar";
}
else if (int_month == 4)
{
mon = "apr";
}
else if (int_month == 5)
{
mon = "may";
}
else if (int_month == 6)
{
mon = "jun";
}
else if (int_month == 7)
{
mon = "jul";
}
else if (int_month == 8)
{
mon = "aug";
}
else if (int_month == 9)
{
mon = "sep";
}
else if (int_month == 10)
{
mon = "oct";
}
else if (int_month == 11)
{
mon = "nov";
}
else
{
mon = "dec";
}
String formatedDate = dd + "-" + mon + "-" + yyyy;
System.out.println("Formatted Date : "+formatedDate );

return formatedDate;
}

Originally posted by paddy singh:
i have started fresh with java and am writing servlets in jsp.
i am retreiving a date field from the database(ms-access)in mm/dd/yy (01/02/01) format but i have to display it on the front end as january,02,01.
on the jsp page ,i retreive the date in a string variable:
String dt=el.elementAt(i).toString();
even if i break this string for date,month,year..how do i convert month from 01 to january.
i would be really glad if u would guide me with this.
thank u in anticipation.



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
Yes you can very well use java mail API with all of its features in JSP.

Originally posted by rishi, yagnik:
Hi friends
I am new to JSP
can somebody tell me how can i send a mail in JSP infact In ASP CDONTS Object is there for sending a mail wht is there in JSP?
can i use Java mail API for the same?
Rishi



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
You should have JSDK2.0+ versions installed, JDK1.1+ versions installed, TOMCAT 3.0+ version installed on the system. Please do triple check the classpath before you begin.

Originally posted by ellen berry:
Hi, there:
I am a new learn, But I do not know which softwares I need to install, then I can run .jsp file. Please give me some suggestion. Thanks a lot.



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
It would be better if you start with servlets. Because without that jsp can provide with very lesser options. For servlets the books are from O'rilley and Techmedia. These are great books with a lot examples and source code. For JSP you need not to go for very illustrative book After you are through with servlets you can download jsp specifications and the jsp tutorial from the http://java.sun.com site. That is very good and updated. Please do consider the version that you are looking for. JSP0.92 doesn't support a lot of things. So go for the latest version. To run JSP you can have freely available tomcat 3.0+.

Originally posted by Vanitha Sugumaran:
Hi,
I want to learn JSP, I don't know where to start, can anyone suggest good books, sites ...
Thanks,
Vanitha.



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
Take the problem like this way....
1. Start a counter..
int intCount=0;
2. Prepare a query and Fetch the resultset
String query="select name from emp";
ResultSet rs=stmt.executeQuery(query);
3. Retrive the values from the result set

while(rs.next())
{
String name=rs.getString("name");
if(count<10)
{
vctVector.addElement(name);
}
count++;
}

5. use vector as data source.
6. In the next ietration update the initial value of count to 10 and the value in the if loop to 20. This can be done dynamically.

Originally posted by Rinku:
Dear sir,
i want to display 10 records per page from my data base
usinf JSP technology
i want to know, can i write any sql query for that or i have write seprate coding .
pls do send any coding you have that in this mail id rinkuraj@yahoo.com
thanks in Adavance
Rinku



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
This is a javascript error which comes when we are trying to make a variable as an object. Some browsers still support that and some not. Please check your version.

Originally posted by vasuma puljety:
Whenever I try to visit Javaranch site, I am getting the following error these days.
An unexpected error occured. Do you wish to debug? Error : Object expected.
What is this? Any of you are getting this ?



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
The path of that gif file or an html file will certainly depend upon the web server that you are using. Because for them every web server has a defualt directory.

Originally posted by Mahajan Bhupendra:
Hi
My friend is having cyber cafe..
He told me that can i make a program like...
If one sits on a comp and started surfing my program
should start counting the time after finishing one hour
it should prompt to server that this this comp has finished
one hour as well as the user should get the prompt..
Is it possible to do in JAVA ??
Or do i need some microsoft thing???
If i can use java what exactly i should start with???
I m confused??
plz help me.....
Thanx in advance...
Bhupendra



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago
If you are trying to export an HTML to excel please try to design your html as simple as possible with the least use of HTML specific things like nested tables etc. If you can do that there will be no problem at all. I have tried it yesterday.

Originally posted by sateesh kommineni:
Hi
I am generating a report in a servlet and sending the report to the Browser in an Excel sheet format. Now how can we format the cells in the Excel sheet. For Example if we want to freeze one column(which can be done in Excel) in the report we are generating then how to get control over the Formatting...
Shall we need to know the File Formatting of the Excel...
pls suggest some good links ....
Thanks in advance..
Sateesh



------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
20 years ago