Thanks santosh!!!!.
The invalid part is working fine. But in giving jsp:forward with file it
gives an exception
<jsp:forward page="file://d:/...> the path i get following exception
java.io.IOException: The filename, directory name, or volume label syntax is
incorrect
at java.io.Win32FileSystem.canonicalize(Native Method)
at java.io.File.getCanonicalPath(File.java:441)
at com.sun.web.core.DefaultServlet.doGet(DefaultServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:715)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
at
com.sun.web.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:84
)
at
com.sun.jsp.runtime.PageContextImpl.forward(PageContextImpl.java:314)
at
D_0003a.jswdk.jswdk_0002d_00031_0005f_00030_0005f_00031.examples.jsp.guest.j
sp_0005cguest_0005clogin_0002ejsplogin_jsp_1._jspService(jsp_0005cguest_0005
clogin_0002ejsplogin_jsp_1.java:82)
at com.sun.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:88)
at
com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218)
at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
at com.sun.web.core.Context.handleRequest(Context.java:414)
at
com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)
-----Original Message-----
From: Daryani Santosh [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 1:59 PM
To: [EMAIL PROTECTED]
Subject: Re: If condition in jsp
This might work try using the equals method
if ( id.equals("")
{
out.println("Invalid login Id");
}
else
{
%>
<jsp:forward page="What ever page or JSP you want"/>
<%
following code
%>
Santosh
Kuklani Mahesh <[EMAIL PROTECTED]> on 06/12/2000 01:37:08 PM
Please respond to A mailing list about Java Server Pages specification and
reference <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Santosh Daryani/IT/Aon Consulting)
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