Thanks Chris. My problem is solved.
-----Original Message-----
From: Chris Ernenwein [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 5:25 PM
To: [EMAIL PROTECTED]
Subject: Re: If condition in jsp
did you try this:
<% String id = request.getParameter("cid") ;
if(request.getParameter("cid") != null)
{
out.println("Hello ") ;
out.println(id) ;
}
else
{
response.sendRedirect("D:\\jswdk\\jswdk-1.0.1\\examples\\WEB-INF\\servlets\\
login.html") ;
} %>
like I posted before?
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Kuklani Mahesh
Sent: Monday, June 12, 2000 10:55 AM
To: [EMAIL PROTECTED]
Subject: Re: If condition in jsp
I tried changing the code i.e this way but i want if the text item is null
take him to login page again else say Hello and whatever his id is.
<% String id = request.getParameter("cid") ;
if(id !="")
{
out.println("Hello ") ;
out.println(id) ;
}
else
{
response.sendRedirect("D:\\jswdk\\jswdk-1.0.1\\examples\\WEB-INF\\servlets\\
login.html") ;
} %>
-----Original Message-----
From: Chris Ernenwein [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 4:48 PM
To: [EMAIL PROTECTED]
Subject: Re: If condition in jsp
try
if (request.getParameter("cid") != null) {
// blah blah
}
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Kuklani Mahesh
Sent: Monday, June 12, 2000 10:37 AM
To: [EMAIL PROTECTED]
Subject: If condition in jsp
Hi ,
I am new to jsp and want to design a form. The form has 2 fields id and
password. I want to check in jsp whether if the field is null then re-direct
him to login.html again. Below is my code, if i am sending blank id field
still i am getting hello printed on the browser but i want it to redirect to
login page.
login.jsp
<html>
<head>
<title> Login Successfull </title>
</head>
<body>
<%@ page language="java" %>
<% String id = request.getParameter("cid") ;
if(id =="" || id == " " || id == " ")
{
response.sendRedirect("D:\\jswdk\\jswdk-1.0.1\\examples\\WEB-INF\\servlets\\
login.html") ;
}
else
{ %>
Hello <%=request.getParameter("cid") %>
<% } %>
</body>
</html>
Thanks in advance.
Mahesh.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets