you must use
if (action.equals("view"))
or to check for both upper case and lower case
action.equalsIgnoreCase("view")
sometimes if action is null, the above method might throw a null pointer
exception
so
if( action != null && action.equalsIgnoreCase("view")) would be fine
Regards,
Nagarajan.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Isak Rickyanto
Sent: Tuesday, September 18, 2001 11:59 AM
To: [EMAIL PROTECTED]
Subject: passing variable success but...
Hello All....... I need help
I write this code in JSP
I had problem with this code below...
I want to do something if someone click in VIEW...
and it pass action variable action=view... and it will do something..
but I only found that the screen display action=view but
"YOU CAN ONLY SEE THIS IF ACTION = VIEW" not appear in the screen?
What's wrong with my code ?
I have created code to edit profile membership like below :
<%@ page language="java" import="java.util.*,java.sql.*" %>
<html>
<head>
<title>My Account Profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
String action=request.getParameter("action");
%>
<a href="profil.jsp?action=view">VIEW</a> OR <a
href="profil.jsp?action=edit">EDIT</a>
<%
if (request.getMethod().equals("GET"))
{
%>
THE ACTION <%=action%>
<%
if (action=="view")
{
out.println("YOU CAN ONLY SEE THIS IF ACTION=VIEW");
}
}
%>
</body>
</html>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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