By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,790 Members | 1,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,790 IT Pros & Developers. It's quick & easy.

post variables null

oll3i
100+
P: 679
Expand|Select|Wrap|Line Numbers
  1. html>
  2.     <head>
  3.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4.         <link rel="stylesheet" type="text/css" href="css.css"/>
  5.         <title>HRMailer</title>
  6.     </head>
  7.     <body>
  8.        <table width="900">
  9.             <tr>
  10.                 <td valign="top">     
  11.             <table align="left">
  12.                 <tr><td width="150px" aling="left"><a href="inbox.jsp?k=%2B&f=0">Inbox</a></td></tr>
  13.                 <tr><td><a href="sent.jsp?k=%2B&f=0">sent</a></td></tr>
  14.                 <tr><td><a href="drafts.jsp?k=%2B&f=0">drafts</a></td></tr>
  15.                 <tr><td><a href="trash.jsp?k=%2B&f=0">Trash</a></td></tr> 
  16.             </table>
  17.  
  18.        <table> <form action="send.jsp" method="post" enctype="multipart/form-data">
  19.            <tr><td>Subject:</td>
  20.                <td><input type="text" name="subject"><td>
  21.            </tr>
  22.            <tr>
  23.                <td>From</td>
  24.                <td>
  25.  
  26. <input type="text" name="from" value="kasia@purcon.pl">
  27. </td> </tr>
  28.  
  29.            <tr>
  30. <td>To:</td>
  31. <td><input type="text" name="to"></td>
  32.            </tr>
  33.            <tr>
  34.            <tr>
  35. <td>Body:</td> 
  36. <td valign="buttom">
  37. <textarea rows="10" cols="30" name="body">
  38.  
Expand|Select|Wrap|Line Numbers
  1. public class sendMail extends HttpServlet   {
  2.         public void sending(HttpServletRequest request, HttpServletResponse response)  
  3.             throws ServletException, IOException {  
  4.           HttpSession session1 = request.getSession();
  5.          String subject=request.getParameter("subject");
  6.          String to=request.getParameter("to");
  7.          String body=request.getParameter("body");
  8.          String from =  (String)session1.getAttribute("username");
  9.          String file = request.getParameter("file");
  10.          String password = (String)session1.getAttribute("password");
  11.  

Why all the variables are null ?

Thank YOU
Sep 30 '13 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
If you want to upload a file to the server using multipart/form-data then google how to upload files first and see what APIs you need to upload the file and post parameters first.
Oct 3 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.