JSP get/set 중.. 값이 안넘어 갑니다

storm357의 이미지

test.jsp

 
 
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form action="test_control.jsp" method="post" name="form1">
 
  <p>
  Code
  <input type="text" name="b_code" />
  </p>
  <p>
    Title
    <label for="b_title"></label>
    <input type="text" name="b_title" />
  </p>
  <p>Company
    <label for="b_company"></label>
    <input type="text" name="b_company" />
  </p>
  <p>MadeDate
    <label for="b_madedate"></label>
    <input type="text" name="b_madedate" />
  </p>
  <p>Buy Cost
    <label for="b_buycost"></label>
    <input type="text" name="b_buycost" />
  </p>
  <p>Sell Cost
    <label for="b_sellcost"></label>
    <input type="text" name="b_sellcost" />
  </p>
  <p>EA
    <input type="text" name="b_ea" />
  </p>
  <p>IMG
    <label for="b_img"></label>
    <input type="file" name="b_img"/>
  </p>
  <p>&nbsp;</p>
  <p>
    <input type="submit" name="button" value="Submit" />
  </p>
 
</form>
</body>
</html>

test_countrol.jsp

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR" import="test.test.*" %>
<jsp:useBean id="tb" class="test.test.testBean"/>
<jsp:useBean id="test" class="test.test.Test" scope="page" />
<jsp:setProperty name="test" property="*"/>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<% request.setCharacterEncoding("euc-kr"); %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
 
<%
 out.println(request.getParameter("b_code"));
 out.println(test.getB_title());
%>
</body>
</html>

Test.java

package test.test;
 
import java.util.*;
 
public class Test {
 
 private String b_code;
 private String b_title;
 private String b_company;
 private int b_buycost;
 private int b_sellcost;
 private int b_ea;
 
 public int getB_buycost() {
  return b_buycost;
 }
 public void setB_buycost(int b_buycost) {
  this.b_buycost = b_buycost;
 }
 public String getB_code() {
  return b_code;
 }
 public void setB_code(String b_code) {
  this.b_code = b_code;
 }
 public String getB_company() {
  return b_company;
 }
 public void setB_company(String b_company) {
  this.b_company = b_company;
 }
 public int getB_ea() {
  return b_ea;
 }
 public void setB_ea(int b_ea) {
  this.b_ea = b_ea;
 }
 public int getB_sellcost() {
  return b_sellcost;
 }
 public void setB_sellcost(int b_sellcost) {
  this.b_sellcost = b_sellcost;
 }
 public String getB_title() {
  return b_title;
 }
 public void setB_title(String b_title) {
  this.b_title = b_title;
 }
 
 
}

위 소스 들을 이용해서 DB에다가 값을 입력 하는 간딴한 페이지를 구현중입니다.

헌데.. 값이 안들어가네요.. 이유는 Null 값을 넣어서 그렇다고 합니다.

그래서.. test_control.jsp 페이지에서 값을 확인해 보려 하는데.. 파라미터로 받은건 값이 제대로 나오는데

getB_title()로 받아온 건.. 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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.