| Author |
send data to email
|
jil shi
Greenhorn
Joined: Feb 17, 2004
Posts: 20
|
|
i face a problem here. for your information, i'm using jsp to handle my wen site. the problem is i have created list box in my web page. i am able successfully enter the data selected in database(mysql). the data that was inserted in database is code that represent the detail in the list box. for example, when i choose 'apartment' from list box, 'AP' will be inserted into database. i can do all these except how can i send the information to email. i know how to send email but when the recepient receive, they will get the code data. For example, they will get 'AP' instead of 'apartment'. how can i send the full word to email??? below is some part of my coding:<option selected="selected" value="done">--Select--</option> <% String select_2 = "SELECT smd_cde2_typ, smd_cde2, smd_cde2_desc "+ "FROM smcde2 "+ "WHERE smd_cde2_typ = 'T' "+ "ORDER BY smd_cde2_desc "; Statement stmt_2 = conn.createStatement(); ResultSet rset_2 = stmt_2.executeQuery(select_2); while (rset_2.next()) { property_code = rset_2.getString("smd_cde2"); property_desc = rset_2.getString("smd_cde2_desc");%> <option value="<%=property_code%>"><%=property_desc%></option> <% } %> </select>
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56193
|
|
|
Not a JSP question so I'm shuffling this off to the JDBC forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Jil, Do you have a field in the database that contains the work instead of a code?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Prakash Anthony
Greenhorn
Joined: Apr 03, 2004
Posts: 5
|
|
You could use a CASE expression to do this. Following is an example: SELECT EMPNO, LASTNAME, CASE SUBSTR(WORKDEPT,1,1) WHEN �A� THEN �Administration� WHEN �B� THEN �Human Resources� WHEN �C� THEN �Accounting� WHEN �D� THEN �Design� WHEN �E� THEN �Operations� END FROM EMPLOYEE;
|
 |
Prakash Anthony
Greenhorn
Joined: Apr 03, 2004
Posts: 5
|
|
|
But rather than hard coding these, I would go for joining the CODE column on to a table which has the descriptive names.
|
 |
Prakash Anthony
Greenhorn
Joined: Apr 03, 2004
Posts: 5
|
|
|
Having said that, rather than hard coding these, I would go for joining the CODE column on to a table which has the descriptive names.
|
 |
jil shi
Greenhorn
Joined: Feb 17, 2004
Posts: 20
|
|
for your information, smd_cde2_typ refers to type. smd_cde2 refers to code and smd_cde2_desc refers to the description. For example, when i choose "apartment" in list bar, "AP" will be inserted database and apartment should send to email. "AP" refers to smd_cde2. secondly, "apartment" should send to email. "apartment" refers to smd_cde2_desc. now i can insert code and send code to email. what i need is insert code into database and send description to email. How can i solve my problem?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Jil, You need two queries. One to do the insert. And one (with the join) to select the full name for the e-mail.
|
 |
 |
|
|
subject: send data to email
|
|
|