wood burning stoves 2.0*
The moose likes JDBC and the fly likes send data to email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "send data to email" Watch "send data to email" New topic
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: 60794
    
  65

Not a JSP question so I'm shuffling this off to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

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: 30130
    
150

Jil,
You need two queries. One to do the insert. And one (with the join) to select the full name for the e-mail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: send data to email
 
Similar Threads
send data to email
How to dynamically set the selected item in a drop-down list?
How to get last selected value in list box?
Application Resources.properties
taglibs problem