equals
public boolean equals(Object anObject)
Compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Overrides:
equals in class Object
Parameters:
anObject - the object to compare this String against.
Returns:
true if the String are equal; false otherwise.
See Also:
compareTo(java.lang.String), equalsIgnoreCase(java.lang.String)
public boolean equals(Object anObject)
Compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Overrides:
equals in class Object
Parameters:
anObject - the object to compare this String against.
Returns:
true if the String are equal; false otherwise.
See Also:
compareTo(java.lang.String), equalsIgnoreCase(java.lang.String)
if(request.getParameter("action")!=null) {
String action=request.getParameter("action");
if(action.equals("add")) {
//添加操作
} else if......
}%>这样用对吗?
或者你String action=(String)request.getParameter("action");试试