fedai gandjaliyev

Ranch Hand
+ Follow
since Dec 05, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by fedai gandjaliyev

Thank you very much for the explanation!
18 years ago
Hello!
I'm trying to establish an applet-servlet communication where I use the Properties
object to pass parameters from the applet to the servlet!
The reason of using the Properties object is that I pass the password as a parameter and it's shown in the address bar of the servlet generated page!
The following works fine
The applet part

for which the servlet part is this


This works fine. But in the following combination of the applet-servet communication
the values of the Properties object are null!
Here is the applet part

And here is the doGet of the servlet in reply to the applet

The size of the the Properties object "table" is 0 in this case and the values are null!
Please help!
Thank you!
18 years ago
Hello!

I'm new to Steams and I was wondering how I can write a Hashtable to an outputstream and on the other side read it converting into a Hashtable again without using ObjectOutput and ObjectInput Streams!
Waiting for your reply.........
Thank you!
18 years ago
I'm still waiting for help!
18 years ago
Hello!
I have three JTextFields and each of them can throw an (different) exception and I need to display a message depending on the JTextField!
Is there a way of getting the source that caused the exception?

Thanks a lot!
18 years ago
I apoloize for not being aware of including code into tags!
In my case I dont keep connecions open!
With the aid of the servlet I just need to verify if the user
trying to gain access is a valid one!


Will it do what I'm trying make it to?
Will it make the servlet reply properly for requests coming
at the same time?

Thanks a lot!
18 years ago
Hello!
I'm trying to write a simple web app based upon applet-servlet communication!
I have a couple of servlets the first of which lets the user to log into the database

The login part of the applet is the following
//on a button click
username = userNameFld.getText().trim();
password = passFld.getText().trim();

try{
loginParameters = "?username=" + username + "&" + "password=" + password;
loginURL = new URL(protocol, hostName, port, "/servlet/AuthenticationServlet/" + loginParameters);
connection = loginURL.openConnection();
connection.setDoInput(true);
connection.setUseCaches(false);

ObjectInputStream ois = new ObjectInputStream(connection.getInputStream());
Request request = (Request) ois.readObject();
ois.close();
String access = request.getAuthorization();

if(!access.equals("success")){

userNameFld.setText(null);
passFld.setText(null);
messageLabel.setText(access);
connection = null;

}else{
//allow further actions
}

}catch(Exception e){
userNameFld.setText(null);
passFld.setText(null);
messageLabel.setText(e.getMessage());
connection = null;
}

The servlet part is the following
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Connection connection = null;
String username = null, password = null, access = null;

username = request.getParameter("username");
password = request.getParameter("password");

Request request = new Request();
try{
//Here go to the database and fill the request object
ObjectOutputStream ous = new ObjectOutputStream();
ous.writeObject(request);
ous.flush();
}catch(Exception e){
}

Each user has a different account so I cant use connection pooling here (although it can be created dinamically but
I dont see it suitable in my case)!
In my case the connection to the database should be alive only for the duration of the doGet() method!
I'm new to servlets and I dont know how to make so that, for example, the doGet() method of the above servlet
can handle multiple requests comming at the same time.
Any suggestion would be of much help!
Please help!

Thank you very much, Feadi!
18 years ago
What I'm trying to deploy is a payment system!
Only valid users can perform payment and the applet should verify if the user whicn logs into the database is a valid user and therefore can perform payment! This is why I have so many different accounts!
All I need to do is to make so that the servlet, AuthenticationServlet in my case, can handle multiple requests at the same time in case of multiple users trying to connect to the database and send a response to the applet saying if the user is a valid one!
But the servlet is going to be accessed by multiple users at the same time!
Putting a new Thread class into the doGet() or doPost() method doesnt seem to work!
Will HttpSession help in this case?
Hello!
I was walking thru the net to get to know how to use
connectiong pooling and I found some articles describing that process.
All of them were basically done with servlets!
All articles recommend to create a ConnectionPool object
at the servlet initialization and it's good!
But the constructor of the ConnectionPool object takes
the url, username, password etc...
As I understand the pool is created for one user only.
I'm using an applet-servlet communication and the user supplies
username and password and I'm not that good at connection pooling yet!
So I need Connection pooling for different users!
How should I create the ConnectionPool object in this case?


Thank you very much, Feadi!
Hello!
I have been using JSP for some time!
But this is the first time I want to ask smth, maybe, unusual!
I have a JSP page that contains fields to gather user supplied data!
I need to do so that a user can pick a date!
I have a DatePicker.jar file which I can use in apps and applets!
But I dont know if it's possible to put a jar(except drivers and etc.) file
onto a JSP just like with an app!
If not how can one "put" a calendar onto a JSP page so that a user pick up a date?

Thank you very much, Feadi!
18 years ago
JSP
Hello!
I'm new to Swing and in one of my first little apps
I have a JTextArea in a JScrollPane!
What I want to ask is that how can I make so that
each new insert into the textarea begins with a new line,
as if you've pressed Enter and typed a new line!
Regards, Fedai!
18 years ago
That really helped me much!
Thanks!
That would really help me very much!
But this is what comes out of this

private class PingMachine extends Thread{

private boolean isRunnable = false;

PingMachine(String machine)
{
host = machine;
}

private void startPinging(){
isRunnable = true;
}
private void stopPinging(){
isRunnable = false;
}

public void run(){
while(isRunnable){
try{
Process p = Runtime.getRuntime().exec("ping -t " + host);
InputStream in = p.getInputStream();
InputStreamReader rin = new InputStreamReader(in);
BufferedReader bin = new BufferedReader(rin);
String s;
System.out.println(new Date());
while ((s=bin.readLine()) != null) {
System.out.println(s);
}

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

}

}

}

And I have two buttons
//On start button
pinger = new PingMachine("localhost");
pinger.start();
//On stop button
//This is the same pinger
pinger.stopPinging();
But when the method "stopPinging()"
have this form
private void stopPinging(){
isRunnable = false;
}
the thread stops
Why assigning "false" to the variable isRunnable
doesnt stop the thread?
Thank you!