(ret_url == null) <--false 근데.. ret_url 은 null...이게

익명 사용자의 이미지

얼마전에 바로 jsp를 시작했는데요..

책에 예제 연습하다가

진짜..말도 안되는...이런...황당한 경우가..(물런 제 생각)

정말 답답해서...이렇게 질문드립니다...

게시판 관리자 로그인부분인데요...
---------------------------------------------------------------------

<@ page info="admin login" errorPage="error.jsp" %> <%@ page contentType="text/html; charset=euc-kr" %> <% String adminid = myutil.checkNull(request.getParameter ("adminid")); String password = myutil.checkNull(request.getParameter ("password")); String ret_url = request.getParameter("ret_url");

if(ret_url == null){
ret_url = "list.jsp";
out.println("<script>alert('1" + ret_url + "');</script>");

}
out.println("<script>alert('" + (ret_url == null)
+ "');</script>");
/******************************** false 라고 나오구요..*/

out.println("<script>alert('2" + ret_url + "');</script>");

/*********************************2null이라고 나오네요..*/
if(adminid.equals("admin") && password.equals("1234")){
session.setAttribute("adminid", adminid);
session.setAttribute("password", password);

response.sendRedirect("ret_url");
}
else{
out.println("<script>alert('아이디와 비밀번호를 다시 확인해
주세요.'); history.back();</script>");
}

%>
------------------------------------------------------------------

이게 도대체 왜이런건지..아무리..생각해도 모르겠네요..

분명 null인데...왜..ret_urㅣ == null 은 false가 나오는지..

http//210.91.138.133/bec7110/board/admin/login.jsp 여기서 아무 아뒤

넣고..비번 아무거나 한번 넣어보시구 확인해보세요..

꼭좀 가르쳐 주시면 고맙겠습니다...

jdk1.4 이구요 tomcat3.2.3 , apache1.3.23입니다..

익명 사용자의 이미지

form 문에 hidden으로 null이라는 string을 대입하셨구먼요.

당연한 결과죠.

익명 사용자의 이미지

히든 값으로 value="<%=ret_url%>" 이렇게 햇는데요..

^^;;

익스에서 소스 보니깐 "null"이렇게 나오네요...

ㅡ,ㅡ;;

저렇게 되면 스트링 "null"이 전해지는건가보네요...

그럼 그냥 null값을 전해줄려면 어떻게 해야 되나요?

value=<%=ret_url%> 이렇게 따움표 빼두 안되던뎅...

아궁..유치한 질문 계속해서 죄송합니다...

^^;;

익명 사용자의 이미지

if(ret_url.equals("null"))
..
또는

if(ret_rul.startsWith("null"))
..

이런식으로 하면 되질 않나요?
왜 반드시 string 객체가 null이 되어야 한는지 모르겠지만
햐여간 지금과 같은 방식으로는 String 객체인 ret_url 을 null 로 만들
수 있는 방법은 없습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.