File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
Servlets
Author
problem using requestdispatcher interface
swichika reddy
Greenhorn
Joined: Dec 28, 2004
Posts: 20
posted
Jan 11, 2005 03:13:00
0
I'm trying to load
JSP
files from servlets.but this program is nort working. can anyone tell me ehat might be the problem.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Login extends HttpServlet{
public void doPost(
HttpServletRequest
req,
HttpServletResponse
res)
throws
ServletException
,IOException{
String
userId = req.getParameter("userId");
String password = req.getParameter("password");
String uName =userId;
// if uName is null .. user is not authorized.
if (uName == null)
{
PrintWriter
ot = res.getWriter();
ot.println(" Please verify the Userid and password");
ot.close();
}
else
{
// So the user is valid let's create a seesion // for this user.
HttpSession
userSession = req.getSession(true);
// put the user name session variable.
userSession.putValue("userName", uName);
// now we need to transfer the control to welcome.jsp
RequestDispatcher
rd =
getServletContext().getRequestDispatcher("/welcome.jsp");
if (rd != null)
{
rd.forward(req,res);
}
}
}// end of doPost
}// end of
servlet
class
thanks in advance.
bye
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56529
14
I like...
posted
Jan 11, 2005 08:48:00
0
Not exactly an
Ant
question is it? Moving to the
Servlets
forum.
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
I like...
posted
Jan 11, 2005 10:58:00
0
What do you mean "not working"? Are you seeing errors in the browser window, in your logs?
Java API
J2EE API
Servlet Spec
JSP Spec
How to ask a question...
Simple Servlet Examples
jsonf
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: problem using requestdispatcher interface
Similar Threads
RequestDispatcher.forward problem
Problems with encodeURL
problem with code
RequestDispatcher
Pass session from JSP to servlet?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter