This week's book giveaway is in the Python forum.
We're giving away four copies of High Performance Python for Data Analytics and have Tiago Rodrigues Antao on-line!
See this thread for details.
Win a copy of High Performance Python for Data Analytics this week in the Python forum!

campos teixeira

Ranch Hand
+ Follow
since May 23, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by campos teixeira

It says the the package validate is never used in the jsp page and it can the

It says it cannot be resolved?

So I did everything by the book! I am using eclipse as a IDE!
16 years ago
Did anyone understood what i want or not?? Any help please??

Also Why my Jsp page wont see my servlet class??

I create a package validate and inside I put the servlet class and tried to call from the jsp page like? <%@ page import="validate.ServletClass" %> but it wont call the servlet?

and then I did?

to call the attributes in the servlet class to print an error message in the footer of the main html??

Does anyone knows why?? I already put the servlet class inside a package so what I am doing wrong??}
16 years ago
Hi all!

Well thats what I would like to do. I have various web forms and I want to send an error message in the footer of each page for every field that is null or empty.

I can do with no problem for one form? but I would like to reuse this servlet for different web forms which will identify each field that is null and send an error message back? but my problem is that each web form are not the same?? One might have more fields than others. I was thinking in put the error messages for each web form in the txt file!

Then I thought in creating an array to read the parameter names in the forms and check to see which one is null then read the error messages for the correspondent web form and field to send back the error messages in the txt file to the footer.

So how do I do it?? I know I have to create an InputStream to read the line but How do I check the error messages in the txt file for the right web form??

I hope you guys can understand what I want??

Any help please or does anyone knows where I can see somewhere almost the same??

16 years ago
Thanks Mike!

But I goot it!! It looks like that the it was asking for the context name in the form action?? It is funny as it didnt ask for it before??

In my action form I had put :

<form action="/ServletLogin > and the jsp page wasnt finding the Servlet class but it did before and it could only now because I put the context name or the method request.getContextPath() in the action then it works very well?!

Does anyone knows why?? I am using Eclipse with Tomcat.

Why I cant call the servlet class directly from the jsp page??
16 years ago
when you say

You mean my full path of the ServletLogin class right?? Which is in my package dbConnect right ?? SO I did

16 years ago
Hi Tim

I think you didnt look very well at my web.xml?? I already have my class and the url mapping?? SO what I am missing out that I cant see it??


SO where that Am I doing wrong even putting in the examples directory in tomcat it only calls the jsp page.
[ June 07, 2004: Message edited by: Mike Curwen ]
16 years ago
I am having an error in tomact and I cant see what the problem is?? It was working before fine. I want to teste but My jsp page cant find the Servlet class??

I am getting this error all the time!

HTTP Status 404 - /ServletLogin

description The requested resource (/ServletLogin) is not available.

Does anyone also had the same problem?? I have been looking in the web but can find anything?

I am working with eclipse and Tomcat! First the tomact index page doesnt
show but My change page does but doesnt call the servlet.

My jsp page is?

and My web.xml is:

Any help please?!

[ June 07, 2004: Message edited by: Mike Curwen ]
16 years ago
Thanks batchu!

Miss out that!!

and to Bear I know it sounds not safe at all but I was just looking for something quick as it is only for testing anyway.
Thanks Nick!

Sounds like good news!! I have no choice but to do, as this is for work and we are in the fase of testing!!

Have no ideia how Am I going to do that but It makes sense to use an arrray to read the lines of the txt and to separated with new line/?

Now! I heard that I will have to create kind of special characters to marks it line of the txt file to go to the right columns? Is that right?

Anyway I will post my code soon here if I have any problems which I problem will have . This isnt a job for a newbie but kind enjoying the challenge.

Thanks again
16 years ago
Nice reply hein?
16 years ago

Does anyone knows how or where I can find information of how I can read a file and get this file to populate the database??

I know the part of opening a file to read and to do updates to database but How do I get the exaclty data in the txt file to go into the right columns into the table??

Can anyone point me to the right direction please?

Do I have to use StringTokenizer??

16 years ago
Thanks cj jack

I really miss out the userId argument type but I was trying to see it is works and I had a problem with eclipse and tomcat which didnt want to work??

Funny yearsterday was working fine and today I couldnt do nothing so now only monday to see is its working.

I did eveything that was said and now just need to test on monday as I dont have a database at home?? Will try to install ORacle 9i>

Anyway thanks very much for all the help from everyone.

Will let you guys know if it is worke or not! I hope it does

This is the source code:

Servlet[CODEpackage dbConnect;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

public class ServletLogin extends HttpServlet {

//Statement stm;
//ResultSet rs = null;
PreparedStatement update =null;
Connection con = null;
String DbUserName = "eloi";
String DbPassword = "trocar";

public void init() throws ServletException {


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

doPost( request, response );

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


Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://ANDROMEDA:1433",DbUserName, DbPassword);

PreparedStatement update = con.prepareStatement("insert into WIZUSUARIOS (UID, PWD, Nome)"
+ "values(? ,? ,? )");

catch(Exception sqle ){
System.out.println("Error message at" +sqle);
//System.out.println("Error message at" + cne);




catch(SQLException e){

System.out.println("Error at" + e);

public void destroy() {

try {
if(update != null)
catch(SQLException e){
System.out.println("Error at" + e);
if(con != null)
catch (SQLException sqle) {
//throw new ServletException( "SQL error trying to do this or that: " + sqle);
System.out.println("Error at" + sqle);



the web form is:

and the eror messsage is

Its funny because before it didnt come this message just a blank page??
Well I think it could be in the

Do you think that I can do this??

con.prepareStatement("update WIZUSUARIOS set UID = ' " + userID + ", PWD = '" + password + " , Nome = ' " + name + "where UID = 'papai' and PWD = 'mamae' and Nome = 'parents'");

SO what you guys think??

Help newbie please!

I have been long time without practice with Java but I can do it?? I just think I am missing somehing here!

It gives an error nullpointexception I think that the servlets is dying before getting the parameter from the user or or the connection is being closed before sending the parameter into the database.

What you think??
Sorry I think is the statement:

Statement statement;

int value = statement.executeUpdate();