Chetan Chauhan

Greenhorn
+ Follow
since Oct 03, 2006
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 Chetan Chauhan

Hi all !!

I have created a simple jsp page and installed it on SOLARIS Web Server.

Now when i tried to open that page in IE, it is running perfectly.

But when i try to run that page in Firefox or Netscape navigator, it

doesn't.

It shows the programming coding as well as web page on firefox and netscape.

The page can be accessed at the following link:

http://www-rohan.sdsu.edu/~seegehal/test/sandiego/index.jsp

Can anyone solve my problem ??
17 years ago
JSP
Hello Everybody !!

I use NetBeansIDE4.1 for developing jsp and servlet applications.

It comes with bundled in Tomcat-5.5.7.

I wrote a simple code for database connectivity using MS-ACCESS and
system-DSN

Here is the piece of code:

Connection con;
Statement stat;
String NewLanguage=new String("SPANISH");
String sql=new String("insert into languages values (1,'" + NewLanguage.toLowerCase() + "',1,null,null)");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:dsn_lang");
stat=con.createStatement();
stat.executeUpdate(sql);
stat.close();
con.commit();

out.println("<h1>New Language Added...</h1>");


stat.close();
con.close();
}catch(Exception e){}
}
It is working fine.

But when i try to deploy the .war file onto a separate machine with TOMCAT-5.5.9 and java libraries and MS-ACCESS database,the code doesnt work. Jsp messages and other effects are running properly but stuff from database is not coming on the page. System-DSN is also proper.

Then i installed TOMCAT 5.5.9 on my machine and called it inside NetBeansIDE4.1. Again the project run fine.

Then what happens when i run the project outside the IDE on the same or different TOMCAT server ?

Can anybody please solve my problem ?
Hello Everybody !!

I use NetBeansIDE4.1 for developing jsp and servlet applications.

It comes with bundled in Tomcat-5.5.7.

I wrote a simple code for database connectivity using MS-ACCESS and
system-DSN

Here is the piece of code:

Connection con;
Statement stat;
String NewLanguage=new String("SPANISH");
String sql=new String("insert into languages values (1,'" + NewLanguage.toLowerCase() + "',1,null,null)");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:dsn_lang");
stat=con.createStatement();
stat.executeUpdate(sql);
stat.close();
con.commit();

out.println("<h1>New Language Added...</h1>");


stat.close();
con.close();
}catch(Exception e){}
}
It is working fine.

But when i try to deploy the .war file onto a separate machine with TOMCAT-5.5.9 and java libraries and MS-ACCESS database,the code doesnt work. Jsp messages and other effects are running properly but stuff from database is not coming on the page. System-DSN is also proper.

Then i installed TOMCAT 5.5.9 on my machine and called it inside NetBeansIDE4.1. Again the project run fine.

Then what happens when i run the project outside the IDE on the same or different TOMCAT server ?

Can anybody please solve my problem ?
17 years ago
JSP
Hello Anand, You have asked the difference between these two statements:

<form name="loginForm" method="post" action="CrdServlet/LoginHandlerServlet">

<form name="loginForm" method="post" action="LoginHandlerServlet">

1st statement specifies the complete path of LoginHandler. CrdServlet is also the name of the project, it seems from web.xml file.
While 2nd statement assumes that LoginHandler is in the current working directory.
If you write LoginHandler in some other directory say, xyz/LoginHandler then you have to specify its path as

xyz/LoginHandlerServlet OR
CrdServlet/xyz/LoginHandlerServlet

in the action attribute.
17 years ago
JSP
I m trying to use NetBeansIDE4.1 for developing jsp and servlet applications.
It comes with bundled in Tomcat-5.5.7.
I wrote a simple code for database connectivity using MS-ACCESS and
system-DSN
It is working fine.
But when i try to deploy the .war file onto a separate machine with TOMCAT-5.5.9 and java libraries and MS-ACCESS database,the code doesnt work. Jsp messages and other effects are running properly but stuff from database is not coming on the page. System-DSN is also proper.

Then i installed TOMCAT 5.5.9 on my machine and called it inside NetBeansIDE4.1. Again the project run fine.

Then what happens when i run the project outside the IDE on the same or different TOMCAT server ?

Here is a piece of code:

Connection con;
Statement stat;
String NewLanguage=new String("SPANISH");
String sql=new String("insert into languages values (1,'" + NewLanguage.toLowerCase() + "',1,null,null)");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:dsn_lang");
stat=con.createStatement();
stat.executeUpdate(sql);
stat.close();
con.commit();

out.println("<h1>New Language Added...</h1>");


stat.close();
con.close();
}catch(Exception e){}
}
17 years ago
JSP
Your code for one.jsp
---------------------
<input type="text" name="username">
<input type="password" name="password">

You wrote code for two.jsp
----------------------------
String user = request.getParameter("username");
welcome , <%=user%>

U have two fields city and state in two.jsp
<input type="text" name="city">
<input type="text" name="state">
and a hidden field,
<input type="hidden" name="uname">

in two.jsp set the value for "uname" hidden parameter equals to "username" which you received as request

Then Code for three.jsp should be
----------------------------------
String user = request.getParameter("uname");
welcome , <%=user%> on Page Three
17 years ago
JSP
If you do not wish to use in-built Session features then you can use
either of the following two techniques

1. Use Hidden Fields
2. Use Cookies

Then there will be no need to write code for session tracking.
But ofcourse some different code has to be there to implement this.
17 years ago
JSP
Hello Achalveer,
i was going through your problem.
you were using Statement object and createStatement() methods in your code, which you shouldn'w because these doesn't support parameters i.e. usage of "where" clause in "select" query.
So instead use PreparedStatement object and then use prepareStatement() method to use "where" clause in "select" query.
i hope your problem will be solved.
17 years ago
JSP