post variables null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    post variables null

    Code:
    html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="stylesheet" type="text/css" href="css.css"/>
            <title>HRMailer</title>
        </head>
        <body>
           <table width="900">
                <tr>
                    <td valign="top">     
                <table align="left">
                    <tr><td width="150px" aling="left"><a href="inbox.jsp?k=%2B&f=0">Inbox</a></td></tr>
                    <tr><td><a href="sent.jsp?k=%2B&f=0">sent</a></td></tr>
                    <tr><td><a href="drafts.jsp?k=%2B&f=0">drafts</a></td></tr>
                    <tr><td><a href="trash.jsp?k=%2B&f=0">Trash</a></td></tr> 
                </table>
           
           <table> <form action="send.jsp" method="post" enctype="multipart/form-data">
               <tr><td>Subject:</td>
                   <td><input type="text" name="subject"><td>
               </tr>
               <tr>
                   <td>From</td>
                   <td>
                       
    <input type="text" name="from" value="kasia@purcon.pl">
    </td> </tr>
             
               <tr>
    <td>To:</td>
    <td><input type="text" name="to"></td>
               </tr>
               <tr>
               <tr>
    <td>Body:</td> 
    <td valign="buttom">
    <textarea rows="10" cols="30" name="body">
    Code:
    public class sendMail extends HttpServlet   {
            public void sending(HttpServletRequest request, HttpServletResponse response)  
                throws ServletException, IOException {  
              HttpSession session1 = request.getSession();
             String subject=request.getParameter("subject");
             String to=request.getParameter("to");
             String body=request.getParameter("body");
             String from =  (String)session1.getAttribute("username");
             String file = request.getParameter("file");
             String password = (String)session1.getAttribute("password");

    Why all the variables are null ?

    Thank YOU
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    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.

    Comment

    Working...