saquib nisar

Greenhorn
+ Follow
since Nov 13, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by saquib nisar

Thanks for the reply. We are using encodeURL - sorry for the confusion.
I have just discovered a KB entry on the IPlanet support site, which states that encodeURL causes problems such as I have seen. The soloution is to use absolute paths in the URL or to put ../ in front of the URL.
Has anyone else seen problems with encodeURL and IPlanet? Ther same servlets seem to work OK with Tomcat/Apache.

Thanks for responses.
23 years ago
Thanks for the reply. We are using encodeURL - sorry for the confusion.
I have just discovered a KB entry on the IPlanet support site, which states that encodeURL causes problems such as I have seen. The soloution is to use absolute paths in the URL or to put ../ in front of the URL.
Has anyone else seen problems with encodeURL and IPlanet? Ther same servlets seem to work OK with Tomcat/Apache.

Thanks for responses.
23 years ago
Below is a very simple example servlet, which generates a form, with 1 input field, and a submit button. Is re-posts to itself.
If I run using a local Tomcat/Apache server it works fine, I can submit the form as many times as I want.
However, when I run via our IPlanet webserver, the first submit works, but the second submit give a error message:
Bad request
Your browser sent a query this server could not understand.
The code is:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class testform extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("<HTML><HEAD><TITLE>Test form</TITLE></HEAD><BODY>");

out.println("<FORM METHOD='POST' ACTION='testform'>");

out.println("NAME:<INPUT TYPE='TEXT' NAME='name' VALUE=''>");
out.println("<INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='SUBMIT'>");

out.println("</FORM></BODY></HTML>");
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
23 years ago
Below is a very simple example servlet, which generates a form, with 1 input field, and a submit button. Is re-posts to itself.
If I run using a local Tomcat/Apache server it works fine, I can submit the form as many times as I want.
However, when I run via our IPlanet webserver, the first submit works, but the second submit give a error message:
Bad request
Your browser sent a query this server could not understand.
The code is:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class testform extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("<HTML><HEAD><TITLE>Test form</TITLE></HEAD><BODY>");

out.println("<FORM METHOD='POST' ACTION='testform'>");

out.println("NAME:<INPUT TYPE='TEXT' NAME='name' VALUE=''>");
out.println("<INPUT TYPE='SUBMIT' NAME='SUBMIT' VALUE='SUBMIT'>");

out.println("</FORM></BODY></HTML>");
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
23 years ago
Please help.
We have servlet which generates a table of data, and allows the user to select a entry to update, by clicking on a URL (built with URLEncode).
When we click on the URL (for example http://localhost/servlet/Test), this will take us into a form (generated from within the same servlet), where the action on the for is ACTION='test'. On submit of the form, this posts back
to the same servlet, but the URL at in brower now says 'http://localhost/servlet/Test/Test' and the next time a URL is clicked on the URL says 'http://localhost/servlet/Test/Test/Test'.
Any idea why this is happening? Webserver is Iplanet Fasttrack.
Saquib
23 years ago
Please help.
We have servlet which generates a table of data, and allows the user to select a entry to update, by clicking on a URL (built with URLEncode).
When we click on the URL (for example http://localhost/servlet/Test), this will take us into a form (generated from within the same servlet), where the action on the for is ACTION='test'. On submit of the form, this posts back
to the same servlet, but the URL at in brower now says 'http://localhost/servlet/Test/Test' and the next time a URL is clicked on the URL says 'http://localhost/servlet/Test/Test/Test'.
Any idea why this is happening? Webserver is Iplanet Fasttrack.
Saquib
23 years ago
I need to insert two records into a Oracle DB, which are linked via object id's which are generated from a sequence.
So, the code would be:
Create Record1
Set Record1.Id = some sequence
Create Record2
Record2.Link = Record1.Id
But, once I have created record1 how do I know which record was created, or with which sequence?
Please help.
snisar@caluk.com

Originally posted by Peter den Haan:
"Fails" as in...
Works and returns data but doesn't pool?
Appears to work but doesn't return any data?
Throws an exception? What exception and stack trace?
What servlet engine? Do you have any idea if your servlet was instantiated more than once?


Peter,
It raises an exception, in the following section of code:
// send a request to the database
public void sendRequest (String sqlString)
throws SQLException, ClassNotFoundException, PoolException {
if (inUse)
closeRequest();
impl = connectionPool.acquireImpl(dbName);
stmt = impl.getConnection().createStatement();
rs = stmt.executeQuery(sqlString);
inUse = true;
}
The exception is on line impl = connectionPool.aq ...
I am using Tomcat, integrated with Apache.
I believe the error is something to do with not having a instance of the pool object available???
Thanks for your help.
Saquib
23 years ago
I have taken some connection pooling code from a website, which works when run stand-alone (i.e. not view a servlet), but fails when run through a servlet. I am posting the code here, to help you gain an idea of what is going on. Apologies in advance for the length of the post.
// ConnectionPoolTest.java - this works
import java.sql.*;
public class ConnectionPoolTest {

public static void main(String args[]) {
try {
// establish database connection
JDBCConnection mydb = new JDBCConnection("AxaDB");
// send SQL request to database
mydb.sendRequest("SELECT name from SYSTEM.Branch WHERE name LIKE '" + "B" + "%'");
// get result set
ResultSet rs = mydb.getRs();
// process result set
while (rs.next())
System.out.println(rs.getString(1));
// release resources
mydb.closeRequest();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// ConnectionPoolTestS.java - this does not work
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class ConnectionPoolTestS extends HttpServlet{

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

try {
// establish database connection
JDBCConnection mydb = new JDBCConnection("AxaDB");
// send SQL request to database
mydb.sendRequest("SELECT name from SYSTEM.Branch WHERE name LIKE '" + "B" + "%'");
// get result set
ResultSet rs = mydb.getRs();
// process result set
while (rs.next())
System.out.println(rs.getString(1));
// release resources
mydb.closeRequest();
} catch (Exception e) {
e.printStackTrace();
}
}
}
The actual pooling code can be found at:
http://www.earthweb.com/dlink.resource-jhtml.72.1395.|repository| |softwaredev|content|article|2000|06|20|SDdejongobpool|SDdejongobpool~xml.0.jhtml?cda=true
Thanks for all your help.
Saquib

23 years ago
I have the following setup:
Directory c:\project1 containing my Java sources
java source files with package com.caluk.utils as the first line.
When these compile they (i.e. the class files) get written to directory c:\project1\com\caluk\utils (using JCreator)
However, if I do a compile of a java source file which imports one of these files (using import com.caluk.utils.*), I get the following errors:
1) If I add c:\project1\com\caluk\utils to my classpath I get a bad class file error
2) Without changing the classpath I do get errors indicating that the class files cannot be found.
What am I doing wrong? Do I need to change the classpath, or should it just work?
Thanks.
Saquib Nisar
snisar@caluk.com
23 years ago
We are just about to embark on our first Java development, an Extranet site, which will be developed using Serlets, JDBC and an Oracle DB. The Webserver to be used is IPlanet on a Sun Solaris box, with LDAP login verification.
Questions:
1) If the application is to be deployed on a Sun UNIX box, if we did the development against a NT machine running IPlanet etc., will have any problems when we deploy?
2) There will be 4 developers working on this application - how do I set different working directories (for WIP objects), and a central directory for booked in objects? Is there any suggested way of doing source control for Servlets?
Thanks for all answers.
Saquib Nisar
snisar@caluk.com
23 years ago
We are just about to embark on our first Java development, an Extranet site, which will be developed using Serlets, JDBC and an Oracle DB. The Webserver to be used is IPlanet on a Sun Solaris box, with LDAP login verification.
Questions:
1) If the application is to be deployed on a Sun UNIX box, if we did the development against a NT machine running IPlanet etc., will have any problems when we deploy?
2) There will be 4 developers working on this application - how do I set different working directories (for WIP objects), and a central directory for booked in objects? Is there any suggested way of doing source control for Servlets?
Thanks for all answers.
Saquib Nisar
snisar@caluk.com
23 years ago
Thanks for the response - I am familiar with the time-spans on cookies, but how does this relate to the hhtpsession api?
For example, if I store a user id using the setattribute, how long will this available when I do getattribute? Will it be available until the brower is closed?
Thanks for all repsonses.
23 years ago
Simple question (I hope).
I hoping to use the HttpSession API to manage session tracking. 2 Questions:
1) Is this suitable for storing a user id, user selections etc.?
2) What is the definition of a session? Is it until the browser is closed, or some time-based concept?
Thanks for you help.
Saquib Nisar
snisar@caluk.com
23 years ago