Problem with ENCTYPE='multipart/form-data'

In my program I want to upload a file along with other details.
I've dowloaded org.apache.commons.fileupload.* jar files and everything works fine only if I give
<INPUT TYPE='file' NAME='file1'>
i.e the file is uploaded
But if I add any other field it becomes blank
Title : <INPUT id=text1 maxlength="30" name=GHN1 >
the value of GHN1 becomes blank. what cud be the problem.
Here is my program
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,java.text.SimpleDateFormat.*,java.text.ParseException.*,java.text.*,java.text.DateFormat.*,java.util.*,java.util.Date.*,com.gh.db.*,org.apache.commons.fileupload.*,org.apache.commons.fileupload.servlet.ServletFileUpload,org.apache.commons.fileupload.disk.DiskFileItemFactory,org.apache.commons.io.FilenameUtils,java.io.*,java.io.File,java.lang.Exception" errorPage="Error.jsp" %>
<%
String TACm1="";
String TASid,Nme="",Cm2="",GHN1="",GHN2="",GHN3="",Sid="";
TACm1=((request.getParameter("TAIdCombo"))!=null?(request.getParameter("TAIdCombo")):"");
DBconnection TApool = DBconnection.getInstance();
Connection con2 = TApool.getConnection();
con2.setAutoCommit(false);
Statement TAst1 = con2.createStatement();
ResultSet TArs1 = null,rs2=null,rs1=null;
Cm2=((request.getParameter("TMIdCombo2"))!=null?(request.getParameter("TMIdCombo2")):"");
java.util.Date d1;
java.sql.Date d2;
SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy");
%>
<html>
<head>
<TITLE>Guest Houses of DOS</TITLE>
</head>
<%@ include file="StdValidations.js" %>
<%@ page buffer="1094kb"%>
<script Language="JavaScript">
</script>
<body onload="window.history.forward(1);">
<FORM ENCTYPE='multipart/form-data' name="GHInfoDetails1"
     method='POST' action="GHInfoDetails1.jsp">'<br><br><br>
<center>
<%      
     String LoginName= "";
     String Name= "";
     String SectionName= "";
     try
          LoginName = session.getAttribute("LoginName").toString();
          Name = session.getAttribute("Name").toString();
          SectionName = session.getAttribute("SectionName").toString();     
     catch(NullPointerException npe)
          %>
          <jsp:forward page="LoginHere.jsp" >
          <jsp:param name="SessionMode" value="Session Expired try again to log on" />
          </jsp:forward>
          <%
%>
<%
          GHN1 = request.getParameter("GHN1");
          if (GHN1 == null) GHN1 = "";
          GHN2 = request.getParameter("GHN2");
          if (GHN2 == null) GHN2 = "";
          GHN3 = request.getParameter("GHN3");
          if (GHN3 == null) GHN3 = "";
%>
     <table width="100%" bgcolor="#F7EDF7">
          <tr >
          <td align="center">
               <img src="Images/Title2.gif">
          </td>
          </tr>
          </table>
          <table width="100%" bgcolor="#F7EDF7">
          <tr>
          <td >
               <b><font face="Times New Roman, Times, serif" color="#402180" size="+1">Logged in as:  <%= Name %></font></b>
          </td>
          <td >
               <b><font face="Comic Sans MS" color="#402180" size="+1">Other Details of Guest House</font></b>
          </td>
          <td align="right">
               <b><font face="Times New Roman, Times, serif" color="#402180" size="+1">Logout</font></b>
          </td>
          </tr>
     </table>
          <table width="100%" bgcolor="#B6C7E5" border="1">
          <tr>
          <td valign="top">
          </br>
          <p><img src="Images/bullet.gif"><b><font face="Times New Roman, Times, serif" color="#402180" size="+0">Defining Guest House Information</font></b></p>
          <p><img src="Images/bullet.gif"><b><font face="Times New Roman, Times, serif" color="#402180" size="+0">Cancelling Guest House Information</font></b></p>
          </td>
          <td align="left"></br>
               <table width="100%" bgcolor="#B6C7E5">
               <tr>
                              <td width="60%" align="right"></br>
                              <P >Category :  <select onChange="TAMAssignCombo2();" name="TMIdCombo2" style="WIDTH: 120px" >
                                                            <option value="-">Select</option>
                                                            <% try
                                                                 PreparedStatement ps6=con2.prepareStatement("Select CategoryName from TableCategory order by CategoryName");
                                                                 rs2 = ps6.executeQuery();     
                                                                 while(rs2.next())
                                                                      Sid=rs2.getString(1);
                                                                           %>
                                                                                <option value = "<% out.write(Sid); %>"><% out.write(Sid); %></option>
                                                                           <%
                                                            catch(Exception e)
                                                                 e.printStackTrace();
                                                            %>
                                                                 <Script>alert("Exception Occured : <%= e %>");</Script>
                                                            <%
                                                            %>
                                             </select>
                              </P>
               </td>
               </tr>
               <tr align="center">
               <td>
                    Title :     <INPUT id=text1 maxlength="30" name=GHN1 onKeyPress="if (((event.keyCode > 32) && (event.keyCode < 48)) || ((event.keyCode > 57) && (event.keyCode < 65)) || ((event.keyCode > 90) && (event.keyCode < 97))) event.returnValue=false;">
               </td>
               </tr>
               <tr align="center">
               <td>
                    Reference No :     <INPUT id=text1 maxlength="100" name=GHN2 onKeyPress="if (((event.keyCode > 32) && (event.keyCode < 48)) || ((event.keyCode > 57) && (event.keyCode < 65)) || ((event.keyCode > 90) && (event.keyCode < 97))) event.returnValue=false;">
               </td>
               </tr>
               <tr align="center">
               <td>
                    Date :     <INPUT id=text1 maxlength="30" name=GHN3 >
               </td>
               </tr>
               <tr align="center">
               <td >
               </br>
                                       File Name:        <INPUT TYPE='file' NAME='file1'></p>
               </td></tr>
               <tr>
               <td align="center">
                                                     <INPUT TYPE='submit' VALUE='Submit' ></br>
               <b><font face="Times New Roman, Times, serif" color="#402180" size="3">(Information like distance,direction from central places such as Railway station, Airport, Bus Terminal....etc can be added in a file of windows format(such as word, pdf...) and can be uploaded through this screen. This will be displayed for the ISRO Guests.</font></b>)
               </td>
               </tr>
               </table>
          </td>
          </tr>
          </table>
          <table width="100%" bgcolor="#B6C7E5">
          <tr>
          <td align="center">
               </br>
               <img src="Images/Home.jpg">
          </td>
          </tr>
          </table>     
<% if (ServletFileUpload.isMultipartContent(request))
     GHN1 = request.getParameter("GHN1");
     if (GHN1 == null) GHN1 = "";
     GHN2 = request.getParameter("GHN2");
     if (GHN2 == null) GHN2 = "";
     GHN3 = request.getParameter("GHN3");
     if (GHN3 == null) GHN3 = "";
     DiskFileUpload fileUpload = new DiskFileUpload();
     List list = null;
     try
          list = fileUpload.parseRequest(request);
     catch(FileUploadException ex)
          throw new ServletException("Wrapped",ex);
     Iterator iter = list.iterator();
     while (iter.hasNext())
     FileItem item = (FileItem) iter.next();
     if (!item.isFormField())
          File itemFile = new File(item.getName());
          Nme=itemFile.getName();
          %>
          <%
          File destDir = new File(getServletContext().getRealPath("/")
                                   +"stored");
     if(!destDir.exists())
          destDir.mkdirs();
     File destFile = new File(getServletContext().getRealPath("/")
                                   +"stored"+File.separator+itemFile.getName());
     try
          item.write(destFile);
     catch(Exception ex)
          //throw new ServletException("Wrapped",ex);
     TACm1=SectionName;
     %><script>alert("<%=GHN1%>");</script><%
     try
          PreparedStatement ps26=     con2.prepareStatement("select CategoryNo from TableCategory where CategoryName=?");
          ps26.setString(1,Cm2);
          rs1=ps26.executeQuery();
          while (rs1.next())
               PreparedStatement ps16=con2.prepareStatement("inset into TableMetaData (CategoryNo,Title,RefernceNo,Date,FileName) values(?,?,?,?,?)");
               ps16.setString(1,rs1.getString(1));
               ps16.setString(2,GHN1);
               ps16.setString(3,GHN2);
               d1=format.parse(GHN3);
               d2=new java.sql.Date(d1.getTime());     
               ps16.setDate(4,d2);
               ps16.setString(5,Nme);
               int NoOfRows=ps16.executeUpdate();
               con2.commit();
     catch(Exception e)
          e.printStackTrace();
     %>
                         <script> alert("Error : <%= e %>"); </script>
     <%
%>
<%
          if (TAst1 != null) TAst1.close();
                              if (con2 != null)
                                   con2.rollback();
                                   con2.setAutoCommit(true);
                                   TApool.returnConnection(con2);
          %>
<input name="HomePage" type="hidden">
</form>
</body>
</html>

This article is worth reading: http://balusc.blogspot.com/2007/11/multipartfilter.html

Similar Messages

  • Problem with transfering unicode form data in MULTIPART/FORM-DATA

    HI experts,
    I have this web based multilingual application. Page 1(form6.jsp) is basic registeration form with 5 fields and one image upload to the server. Page 2(verify.jsp) is another jsp page for verification of UTF data entered in page 1.
    page 2 (verify.jsp) also uses a bean called (verify.java) for picking up values. page 3(insertEntry.jsp) is the page for inserting that data into the Database and uses a bean called (logicbean.java).
    Now, the problem im facing here is that if i use multipart/form-data, the unicode text filled in page1 is shown as garbage when its is transfered to page2 and displayed on page2. It is all gibberish. But if i do not use multipart/form-data, the unicode text transfered from page1 to page2 is displayed perfectly on page2.Im using devenagari(UTF) language for filling in details.
    // form6.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <HTML>
    <HEAD>
    <TITLE>
    <%=session.getValue("main.title")%>
    </TITLE>
    </HEAD>
    <h1><center><%=session.getValue("main.head")%><Center>
    <BODY background="brown.bmp">
    <form name=form6 action="verify.jsp" method="post" enctype="multipart/form-data">
    <center>
    <font>
    <table border=1>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.ecname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votername"></td>
    <td></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.ecsurname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votersurname"></td>
    <td></td>
    </tr>
    <tr>
    <td align="left"><b>2.)<%=session.getValue("main.rel")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="relation" onchange="if(this.selectedIndex!=0){this.form.texthiddenrelation.value=this.options[this.selectedIndex].value}" size="1">
                                       <option>Choose</option>
    <option value="father">Father</option>
    <option value="mother">Mother</option>
    <option value="husband">Husband</option>
    </select>
    <input type="hidden" name="texthiddenrelation" />
    </td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="parentname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relsurname")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="parentsurname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b>3.)<%=session.getValue("main.sex")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="sex" onchange="if(this.selectedIndex!=0){this.form.texthiddensex.value=this.options[this.selectedIndex].value}" size="1">
                                            <option>Choose</option>
                                            <option value="male">Male</option>
    <option value="female">Female</option>
    <option value="other">Other</option>
    </select>
    <input type="hidden" name="texthiddensex" /> </td>
    <td align="right"><b><%=session.getValue("form6.image")%><input type ="file" name=pic1 onchange={this.form.pic.value=this.form.pic1.value}><input type= hidden name=pic> </b></td>
    </tr>
    <tr>
    <td colspan=2><b>4.)<%=session.getValue("main.age")%></b><input type="text" name="age">
    </td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b>
    <td><b><%=session.getValue("main.dobday")%></b> <select name="cmbday">
    <option value="1"> 1 </option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">10</option>
    <option value="10">11</option>
    <option value="11">12</option>
    <option value="12">13</option>
    <option value="13">14</option>
    <option value="14">15</option>
    <option value="15">16</option>
    <option value="16">17</option>
    <option value="17">18</option>
    <option value="18">19</option>
    <option value="19">20</option>
    <option value="20">21</option>
    <option value="21">22</option>
    <option value="22">23</option>
    <option value="23">24</option>
    <option value="24">25</option>
    <option value="25">26</option>
    <option value="26">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
    <b><%=session.getValue("main.dobmonth")%></b><select name="cmbmonth">
    <option value="jan">JAN</option>
    <option value="feb">FEB</option>
    <option value="mar">MAR</option>
    <option value="apr">APR</option>
    <option value="may">MAY</option>
    <option value="jun">JUN</option>
    <option value="jul">JUL</option>
    <option value="aug">AUG</option>
    <option value="sep">SEPT</option>
    <option value="oct">OCT</option>
    <option value="nov">NOV</option>
    <option value="dec">DEC</option>
    </select>
    <b><%=session.getValue("main.dobyear")%></b> <select name="cmbyear" onchange="if(this.form.cmbday.selectedIndex!=0 && this.form.cmbmonth.selectedIndex!=0 && this.form.cmbyear.selectedIndex!=0){this.form.mergedage.value=this.form.cmbday.options[this.form.cmbday.selectedIndex].value +' '+this.form.cmbmonth.options[this.form.cmbmonth.selectedIndex].text +' '+ this.form.cmbyear.options[this.form.cmbmonth.selectedIndex].value}" size="1">
    <option value="1970">1970</option>
    <option value="1971">1971</option>
    <option value="1972">1972</option>
    <option value="1973">1973</option>
    <option value="1974">1974</option>
    <option value="1975">1975</option>
    <option value="1976">1976</option>
    <option value="1977">1977</option>
    <option value="1978">1978</option>
    <option value="1979">1979</option>
    <option value="1980">1980</option>
    <option value="1981">1981</option>
    <option value="1982">1982</option>
    <option value="1983">1983</option>
    <option value="1984">1984</option>
    <option value="1985">1985</option>
    <option value="1986">1986</option>
    <option value="1987">1987</option>
    <option value="1988">1988</option>
    <option value="1989">1989</option>
    <option value="1990">1990</option>
    <option>
    </select>
    <input type="hidden" name="mergedage">
    </tr>
    <tr>
    <td colspan=2><b>6.)<%=session.getValue("main.add")%></b>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline1")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address1" value=""></td>
    <td><b><%=session.getValue("main.addstate")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="state"></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline2")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address2" onChange="this.form.finaladdress.value=this.form.address1.value + ';' + this.value;"> <input type="hidden" name="finaladdress"> </td>
    <td><b><%=session.getValue("main.addcity")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="city"></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.addpin")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="pincode">
    <td></td>
    </tr>
    <tr>
    <td ><b>7.)<%=session.getValue("main.const")%></b> <input type="text" name="constituency">
    <td ><b>8.)<%=session.getValue("main.id")%></b> &nbsp&nbsp<input type="text" name="refno">
    </tr>
    <tr>
    <td colspan="2"><center><input type="reset" name="reset" value="<%=session.getValue("button.reset")%>">&nbsp&nbsp<input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center></td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </form>
    </font>
    </BODY>
    </HTML>
    // verify.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <jsp:useBean id="verify" class="pack.verify" scope="request"/>
    <%@ page import="com.oreilly.servlet.*" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%!
    MultipartRequest mp;
    // ParameterParser pp;
    %>
    <!-- Perform the actions on the bean. -->
    <%
    //pp.setCharacterEncoding("utf-8");
    %>
    <%
    try
    mp = new MultipartRequest(request, "d:/Files");
    out.println("DONE");
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    verify.setRequest(mp);
    /* Insert the employee data into the database.*/
    verify.verifyEntry();
    //verify.setscope();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQuery();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <form name=form6 action="insertEntry.jsp" method="POST">
    <center>
    <table border=3>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td rowspan=3>
    <image src="<%=verify.getpic()%>" width="85" hieght="85">
    </td>
    </tr>
    <tr>
    <td > &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecname")%></b> <%=verify.getvotername()%>&nbsp&nbsp<input type="hidden" value= "<%=verify.getvotername()%>" name="votername"></td>
    </tr>
    <tr >
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecsurname")%></b><%=verify.getvotersurname()%>
    <input type="hidden" value= "<%=verify.getvotersurname()%>" name="votersurname"></td>
    </tr>
    <tr>
    <td ><b>2.)<%=session.getValue("main.rel")%></b><input type="hidden" value= "<%=verify.getvoterrelation()%>" name="texthiddenrelation"></td>
    <td><%=verify.getvoterrelation()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp <input type="hidden" value= "<%=verify.getparentname()%>" name="parentname"></td>
    <td><%=verify.getparentname()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relsurname")%></b><input type="hidden" value= "<%=verify.getparentsurname()%>" name="parentsurname"></td>
    <td><%=verify.getparentsurname()%></td>
    </tr>
    <tr>
    <td><b>3.)<%=session.getValue("main.sex")%></b><input type="hidden" value= "<%=verify.getsex()%>" name="texthiddensex"></td>
    <td><%=verify.getsex()%></td>
    </tr>
    <tr>
    <td ><b>4.)<%=session.getValue("main.age")%></B><input type="hidden" value= "<%=verify.getage()%>" name="age"></td>
    <td><%=verify.getage()%></td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b> <input type="hidden" value= "<%=verify.getdob()%>" name="mergedage"></td>
    <td> <%=verify.getdob()%></td>
    </tr>
    <tr>
    <td colspan=2><b>
    6.)<b><%=session.getValue("main.add")%></b></td>
    </tr>
    <tr>
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("verify.add")%></b><input type="hidden" value= "<%=verify.getadderess()%>" name="finaladdress"> </td>
    <td><%=verify.getadderess()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addpin")%></b><input type="hidden" value= "<%=verify.getpin()%>" name="pincode"></td>
    <td><%=verify.getpin()%></td>
    </tr>
    <tr>
    <td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addstate")%></b><input type="hidden" value= "<%=verify.getstate()%>" name="state"></td>
    <td><%=verify.getstate()%></td>
    </tr>
    <tr>
    <td><b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<%=session.getValue("main.addcity")%></b><input type="hidden" value= "<%=verify.getcity()%>" name="city"></td>
    <td><%=verify.getcity()%></td>
    </tr>
    <tr>
    <td><b>7.)<%=session.getValue("main.const")%></b> <input type="hidden" value= "<%=verify.getconst()%>" name="constituency"></td>
    <td><%=verify.getconst()%></td>
    </tr>
    <tr>
    <td><b>8.)<%=session.getValue("main.id")%></b> <input type="hidden" value= "<%=verify.getrefno()%>" name="refno"></td>
    <td><%=verify.getrefno()%></td>
    </tr>
    <tr>
    <td colspan="2"><center><INPUT TYPE="button" VALUE="<%=session.getValue("ie.back")%>" onClick="history.go(-1)">
    <input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center><input type="hidden" value= "<%=verify.getpic()%>" name="pic"></td>
    </tr>
    </form>
    </BODY>
    </HTML>
    //verify.java
    package pack;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.oreilly.servlet.*;
    import com.oreilly.servlet.ParameterParser.*;
    * @author Administrator
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class verify {
    String votername = "";
    String votersurname = "";
    String texthiddenrelation="";
    String parentname = "";
    String parentsurname = "";
    String gender = "";
    String texthiddensex="";
    String age = "";
    String dob = "";
    String mergedage="";
    String address = "";
    String finaladdress="";
    String pincode = "";
    String state = "";
    String city = "";
    String constituency = "";
    String refno = "";
    MultipartRequest request = null;
    Connection dbConn = null;
    ParameterParser pp;
    private String voternameParam;
    * Set the request object. This is used for getting parameters.
    public void setRequest(MultipartRequest request)
    this.request = request;
    public void verifyEntry()
    throws Exception
    /* Connect to the database.*/
    //pp.setCharacterEncoding("utf-8");
    //String nameParam = request.getParameter("name");
    MultipartRequest mp;
    System.out.println("connected to db2 through insertemployee");
    /* Get all the parameters from the calling HTML form.*/
    String voternameParam = request.getParameter("votername");
    System.out.println("the votername is " + request.getParameter("votername"));
    System.out.println(voternameParam);
    String votersurnameParam = request.getParameter("votersurname");
    System.out.println("the votersurname is " + request.getParameter("votersurname"));
    String hiddenrelationParam = request.getParameter("texthiddenrelation");
    System.out.println("the relation is " + request.getParameter("texthiddenrelation"));
    String parentnameParam = request.getParameter("parentname");
    System.out.println("the parentname is " + request.getParameter("parentname"));
    String parentsurnameParam = request.getParameter("parentsurname");
    System.out.println("the parentsurname is " + request.getParameter("parentsurname"));
    String ageParam = request.getParameter("age");
    System.out.println("the age is " + request.getParameter("age"));
    String mergedageParam = request.getParameter("mergedage");
    System.out.println("the mergedage is " + request.getParameter("mergedage"));
    String hiddensexParam = request.getParameter("texthiddensex");
    System.out.println("the hiddensex is " + request.getParameter("texthiddensex"));
    //String dobParam = request.getParameter("dob");
    //System.out.println("the dob is " + request.getParameter("dob"));
    String finaladdressParam = request.getParameter("finaladdress");
    System.out.println("the finaladdress is " + request.getParameter("finaladdress"));
    String pincodeParam = request.getParameter("pincode");
    System.out.println("the pincode is " + request.getParameter("pincode"));
    String stateParam = request.getParameter("state");
    System.out.println("the state is " + request.getParameter("state"));
    String cityParam = request.getParameter("city");
    System.out.println("the city is " + request.getParameter("city"));
    String constituencyParam = request.getParameter("constituency");
    System.out.println("the constituency is " + request.getParameter("constituency"));
    String refnoParam = request.getParameter("refno");
    System.out.println("the refno is " + request.getParameter("refno"));
    System.out.println("encoding = " + System.getProperty("file.encoding"));
    public String getvotername()
    return request.getParameter("votername");
    public String getvotersurname()
    return request.getParameter("votersurname");
    public String getvoterrelation()
    return request.getParameter("texthiddenrelation");
    public String getparentname()
    return request.getParameter("parentname");
    public String getparentsurname()
    return request.getParameter("parentsurname");
    public String getage()
    return request.getParameter("age");
    public String getsex()
    return request.getParameter("texthiddensex");
    public String getadderess()
    return request.getParameter("finaladdress");
    public String getpin()
    return request.getParameter("pincode");
    public String getstate()
    return request.getParameter("state");
    public String getcity()
    return request.getParameter("city");
    public String getconst()
    return request.getParameter("constituency");
    public String getrefno()
    return request.getParameter("refno");
    public String getdob()
    return request.getParameter("mergedage");
    public String getpic()
    //String a=request.getParameter("pic");
    //a=a.substring(a.lastIndexOf("/")+1);
    //System.out.print("Java path is "+a);     
    //Enumeration enum=request.getFileNames();
    //while(enum.hasMoreElements())
    //     String abc=(String)enum.nextElement();
    //     System.out.print("Java the path is "+abc);     
    return request.getParameter("pic");
    String votername1;
    //public void setScope()
    //request.setAttribute("votername1" ,voternameParam );
    //insertEntry.jsp
    <jsp:useBean id="logicbean" class="pack.logicbean" scope="request"/>
    <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <!-- Perform the actions on the bean. -->
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <%
    try
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    logicbean.setRequest(request);
    //MultiPartRequest mp=MultiPartRequest(request,"E:\Files");
    /* Insert the employee data into the database.*/
    logicbean.insertEntry();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQueryInsert();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <TITLE>
    Insert Record
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <center><H2><%=session.getValue("ie.label")%>
    </H2>
    <font face = "Devanagari MT for IBM" size = +2>
    <b><%=session.getValue("ie.sd")%>|<%=session.getValue("ie.home")%></b>
    </font>
    </center>
    </BODY>
    </HTML>
    I have narrowed down the problem to the point where i understand that the "request.getParameter()" function for multipart is not able to understand or read UTF data properly. The out.println prints garbage from this function on the console. im using WAS
    plz help
    thanx in advance
    caffaine

    hi,
    To solve your problem Servlet Filters
    FILTER PROGRAM
    ===============
    package filters;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.UnavailableException;
    public class SetCharacterEncodingFilter implements Filter {
    // ----------------------------------------------------- Instance Variables
    * The default character encoding to set for requests that pass through
    * this filter.
    protected String encoding = null;
    * The filter configuration object we are associated with. If this value
    * is null, this filter instance is not currently configured.
    protected FilterConfig filterConfig = null;
    * Should a character encoding specified by the client be ignored?
    protected boolean ignore = true;
    // --------------------------------------------------------- Public Methods
    * Take this filter out of service.
    public void destroy() {
    this.encoding = null;
    this.filterConfig = null;
    * Select and set (if specified) the character encoding to be used to
    * interpret request parameters for this request.
    * @param request The servlet request we are processing
    * @param result The servlet response we are creating
    * @param chain The filter chain we are processing
    * @exception IOException if an input/output error occurs
    * @exception ServletException if a servlet error occurs
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
         throws IOException, ServletException {
    // Conditionally select and set the character encoding to be used
    if (ignore || (request.getCharacterEncoding() == null)) {
    String encoding = selectEncoding(request);
    if (encoding != null)
    request.setCharacterEncoding(encoding);
         // Pass control on to the next filter
    chain.doFilter(request, response);
    * Place this filter into service.
    * @param filterConfig The filter configuration object
    public void init(FilterConfig filterConfig) throws ServletException {
         this.filterConfig = filterConfig;
    this.encoding = filterConfig.getInitParameter("encoding");
    String value = filterConfig.getInitParameter("ignore");
    if (value == null)
    this.ignore = true;
    else if (value.equalsIgnoreCase("true"))
    this.ignore = true;
    else if (value.equalsIgnoreCase("yes"))
    this.ignore = true;
    else
    this.ignore = false;
    // ------------------------------------------------------ Protected Methods
    * Select an appropriate character encoding to be used, based on the
    * characteristics of the current request and/or filter initialization
    * parameters. If no character encoding should be set, return
    * <code>null</code>.
    * <p>
    * The default implementation unconditionally returns the value configured
    * by the <strong>encoding</strong> initialization parameter for this
    * filter.
    * @param request The servlet request we are processing
    protected String selectEncoding(ServletRequest request) {
    return (this.encoding);
    web-xml entry
    +++++++++++
    <filter>     
         <filter-name>Set Character Encoding</filter-name>
    <filter-class>filters.SetCharacterEncodingFilter</filter-class>
              <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>Set Character Encoding</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>

  • Having garbage characters while using enctype="multipart/form-data"

    Hi to all! =)
    I'm uploading a CSV file in JSP ny adding [enctype="multipart/form-data"].
    <html:form method="POST" action="/upload.do" enctype="multipart/form-data">Now, I have a problem on handling Japanese Characters. (becomes garbage)
    I have declared a UTF-8 charset above my JSP
    [<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="Shift_JIS" %>]Using
    System.out.println(response.getCharacterEncoding());in my action, I get "ISO-8859-1" instead of UTF-8
    I don't have any clue why this has happened. Can someone teach me how to override the "ISO-8859-1" coding.
    Any suggestions will be deeply appreciated.

    Hi to all! =)
    I'm uploading a CSV file in JSP ny adding [enctype="multipart/form-data"].
    <html:form method="POST" action="/upload.do" enctype="multipart/form-data">Now, I have a problem on handling Japanese Characters. (becomes garbage)
    I have declared a UTF-8 charset above my JSP
    [<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="Shift_JIS" %>]Using
    System.out.println(response.getCharacterEncoding());in my action, I get "ISO-8859-1" instead of UTF-8
    I don't have any clue why this has happened. Can someone teach me how to override the "ISO-8859-1" coding.
    Any suggestions will be deeply appreciated.

  • H:form enctype="multipart/form-data" gets removed

    I tried to create a file upload page using tomahawk 1.1.6, JSF RI 1.2_05-b06-FCS and facelets.
    What I found is that the h:form removes the enctype="multipart/form-data" when rendering the JSF page.
    In the resulting html page the enctype is entirely missing.
    As a result the fileupload doesn't work, since the browser doesn't even send the file.
    I read that JSF doesn't support multipart messages, but with this behaviour it prevents other libs like tomahawk accomplishing this task. Does anyone know whether there a way to solve this issue other then patching the FormRenderer?
    regards,
    Artur

    Please log an issue [1] (if possible include a test case as an attachement).
    [1] https://javaserverfaces.dev.java.net/issues

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Upload a file to the server - multipart/form-data ?

    I need to upload a file from my local machine to the server from a jsp page. I was asked to use a form with ENCTYPE = "multipart/form-data". but I am not sure how it works. Can any one enlighten me on the process or is there any other way to do it.
    null

    You can find the jsp source & the java sources which exactly does that in the iFS CMS sample code section. Go to Products -> Internet File system -> sample code -> Content Management System. This application allows the user to upload files from a local file system into iFS. This application creates the file in the iFS repository. You may want to save it in the file system of the web server. You may have to make little changes but the functionality is exactly what you are looking for.
    Hope this helps.
    Rajesh

  • Multipart/form-data and file attachment

    Hi ,
    This question has probably been asked before, but if not then here it is. Any replies will be appreciated:
    Q. When using "Enctype=Multipart/form-data", with file attachment alongwith other form fields, is it mandatory to attach a file ? What if user selects no file to attach?
    Q. If no, then how can it be possible that a form can be submitted without attaching a file since when I try to submit a form with no file attached to it, it gives me error message saying :java.lang.NullPointerException
    Q. Does it mean that I can't have a form with a blank "File" input field, if the form's Enctype is "multipart/form-data"? Since users may not select a file to attach to the form, in other words it is an optional.
    I hope I was clear enough in explaining my questions.
    Thanks in advance.

    I am using Orielly's file attachement pacakge.
    Here's what I am doing in my JSP page: It does the following:
    int maxFileSize = 10 * 1024 * 1024; // 5MB max
    String uploadDir = "/direct/files/upload/";
    String FormResults = "";
    String FileResults = "";
    String fileName = "";
    String fileName2 = "";
    String paramName="";
    String paramValue="";     
    File f;
    int filecounter=1;
    first get the form fields using following code:
    MultipartRequest multi = new MultipartRequest(request, uploadDir, maxFileSize);
    Enumeration params = multi.getParameterNames();
    //Get the form information
    while (params.hasMoreElements())
         paramName = (String) params.nextElement();     
         paramValue = multi.getParameter(paramName);
         if (paramName.equals("emailconfirm"))
              emailconfirmation = paramValue;
         else if (paramName.equals("Requester"))
              Requester = paramValue;
         else if (paramName.equals("TodaysDate"))
              TodaysDate = paramValue;
         else if (paramName.equals("Extension"))
    }//end while
    Then it gets the file information using the following code: I have two file fields in my form so that's why I am using a filecounter to find out if user has attached two files or just one:
    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements())
         String formName = (String) files.nextElement();
         if (filecounter == 2)
    fileName2 = multi.getFilesystemName(formName);
         String fileType = multi.getContentType(formName);
              f = multi.getFile(formName);
         FileResults += "<BR>" + formName + "=" + fileName2 + ": Type= " + fileType + ":
    Size= " + f.length();
         else
         {     fileName = multi.getFilesystemName(formName);
              String fileType = multi.getContentType(formName);
              f = multi.getFile(formName);
              FileResults += "<BR>" + formName + "=" + fileName + ": Type= " + fileType + ":
    Size= " + f.length();
         filecounter=filecounter+1;
    Then after composing the mail message I send email with the form fields and file attachments using following code:
    Properties props = new Properties();
    MimeBodyPart mbp1 = new MimeBodyPart();
    MimeBodyPart mbp2 = new MimeBodyPart();
    MimeBodyPart mbp3 = new MimeBodyPart();
    URLDecoder urlDecoder = new URLDecoder();
    String to1 = urlDecoder.decode(toemail);
    String from1 = urlDecoder.decode(fromemail);
    String cc1 = urlDecoder.decode(ccemail);
    props.put( "mail.host", host );
    Session session1 = Session.getDefaultInstance(props, null);
    // Construct the message
    Message msg = new MimeMessage( session1 );
    msg.setFrom( new InternetAddress( from1 ) );
    msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( to1, false ) );
    msg.setRecipients( Message.RecipientType.CC, InternetAddress.parse( cc1, false ) );
    msg.setSubject( subject );
    msg.setHeader( "X-Mailer", "ExceptionErrorMail" );
    msg.setSentDate( new Date() );
    mbp1.setText(mail_message);
    mbp1.setContent(mail_message, "text/html");
    // Send the email message
    FileDataSource fds = new FileDataSource(uploadDir + fileName);
    FileDataSource fds2 = new FileDataSource(uploadDir + fileName2);
    mbp2.setDataHandler(new DataHandler(fds));
    mbp3.setDataHandler(new DataHandler(fds2));
    mbp2.setFileName(fileName);
    mbp3.setFileName(fileName2);
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    mp.addBodyPart(mbp3);
    msg.setContent(mp);
    Transport.send( msg );
    //email sent...
    //delete the two files from the server..
    File f2 =new File(uploadDir + fileName);
    f2.delete();
    File f3 =new File(uploadDir + fileName2);
    f3.delete();     
    //End of code
    So when I don't attach a file and submit my form , I get the error message that I mentioned in my previous post.
    Any more ideas?

  • Multipart/form-data using HTTPService, sending a binary file and some text in the same request.

    Hi There,
             I am new to FLEX and also new to writing a client for a web service.
    My question is more about flex (Flash builder 4.5) APIs, what APIs to use.
    I want to access a web service, that's published here.
    https://build.phonegap.com/docs/write_api
    here is the description of webservice
    ===========
    1) I have to do a post on POST https://build.phonegap.com/api/v1/apps
    2) content type has to be "multipart/form-data"
    3) JSON bodies of requests are expected to have the name 'data'
      data will be someting like this
    'data={"title":"API V1 App","package":"com.alunny.apiv1","version":"0.1.0","create_method":"file"}'
    4) include a zip file in the multipart body of your post, with the parameter name 'file'.
    ===========
    I want to make a 'multipart/form-data' Post and send
    one string and one zip file.
    My first question to self was If i send both string + binary data in the body ...
    how will server understand where string end and where zip file starts?
    Then read on W3.org( http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 )
    How is text + binary data can be sent through "multipart/form-data" post requst.
    there has to be some boundries.
    After this I read and example in flex and  tried following it.
    http://codeio.wordpress.com/2010/04/03/5-minutes-on-adobe-flex-mimic-file-upload-for-in-me mory-contents/
    but it doesn't seems to be working for me.
                        public function createNewApp(cb:Function , appFile : File):void
                                  var service:HTTPService = new HTTPService();
                                  service.url = ROOT+"apps";
                                  service.showBusyCursor = true;
                                  service.addEventListener(ResultEvent.RESULT, function(e:ResultEvent):void {
                                            //translate JSON
                                            trace(e.result);
                                            var result:String = e.result.toString();
                                            var data:Object = JSON.parse(result);
                                            cb(data.link);
                                  service.addEventListener(FaultEvent.FAULT, defaultFaultHandler); //todo : allow user to add his own as well
                                  authAndUploadNewApp(service,appFile);
                        private function authAndUploadNewApp(service:HTTPService,appFile : File):void {
                                  var encoder:Base64Encoder = new Base64Encoder();
                                  encoder.encode(username + ":"+password);
                                  service.headers = {Accept:"application/json", Authorization:"Basic " + encoder.toString()};
                                  service.method ="POST";
                                  var boundary:String = UIDUtil.createUID();
                                  service.contentType = "multipart/form-data; boundary=—————————" + boundary;
                                  var stream:FileStream = new FileStream();
                                  stream.open(appFile, FileMode.READ);
                                  var binaryData:ByteArray = new ByteArray();
                                  var fileData : String = new String();
                                  stream.readBytes(binaryData);
                                  stream.close();
                                  fileData = binaryData.readUTFBytes(binaryData.bytesAvailable); // I think this is where I have problem.... how do
                           //how do i converrt this bytearray/stream of data to string and send it in my post request's body - i guess if this step work rest should work..  
                                  var params: String = new String();
                                  var content:String = "—————————" + boundary + "nr";
                                  content += 'Content-Disposition: form-data; name="data";' + '{"title":"ELS test app 2","package":"com.elsapp.captivate","version":"12.3.09","create_method":"file"}' + "nr";
                                  content += "—————————" + boundary + "nr";
                                  content += 'Content-Disposition: form-data; name="file";' + fileData  + "nr";
                                  content += "—————————–" + boundary + "–nr";
                                  service.request = content;
                                  service.send();

    In the past I have used URLVariables with URLRequest and URLLoader to achieve this kind of requirement.
    Check out http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_3 .html which should be useful. My preference has always been to use this style instead of HTTPService objects, giving you a little more control which is what you need here.
    Let me know if you need any more assistance.

  • What is multipart/form-data ?

    what is multipart/form-data ?
    generally A form have some input fields and a submit button ? but what is
    multipart/form-data ? or is it same thing ?

    http://www.w3.org/TR/REC-html40/interact/forms.html
    enctype = content-type
    This attribute specifies the content type used to submit the form to the server (when the value of method is "post"). The default value for this attribute is "application/x-www-form-urlencoded". The value "multipart/form-data" should be used in combination with the INPUT element, type="file".

  • My Client is having a serious problem with the Contact Form Widget

    My Client is having a serious problem with the Contact Form Widget that I can not figure out how to correct.
    I created a website for a client and inserted a Contact Form widget on their 'Contact Us' page. Whenever anyone uses the form, the e-mail my client receive shows my e-mail address as the sender. So, when they 'reply' to the e-mail, the reply is sent to me and not the person who sent the original message. This creates a major problem in that I get barraged with e-mail replies while my client's potential customers go without a response.
    When I look at  'Site Manager > System E-Mails > Workflow Information > E-mail From Address' on the site's Admin Console, it shows my e-mail information. Is this is what needs to be changed?  If it is, what needs to be placed in that field so that the e-mail my client receives shows the senders e-mail information in the 'From' field.  My client wants to be able to click reply and have the message sent to the right party. They would be very upset if they have to cut and past the senders e-mail address from the body text on every contact they receive.
    Their feeling is that if I can't find a way to make the contact form work the way it should, then it's useless to them.
    Can anyone help me figure this out? I really don't want to disappoint my first client.

    Are you on a plan that has the CRM feature that stores your customers' data? If so, the idea of the contact form is that you'll receive a notification that there's been an inquiry filled out on your contact form and there should be a link in that email notification that leads to the "Case" that was created when that customer filled out a contact form.  You can click that link and visit the case for that customer in your BC site and reply to them from there so that all of the correspondence is logged in the CRM for safe-keeping and for your records.
    If your client finds this is too much work to login to BC to reply every time, then you should check to see if you have the "Customer Service Ticketing" feature on your hosting plan.  This is a feature where you create a dedicated email account (like [email protected]) and the BC system will automatically login to that email account and pull any emails in that inbox and convert them to a customer case for the sender of the email and then it will send out a notification via email to any of the BC Admin users you delegate as "Customer Service Agents".  Since the CST integrates with the BC CRM it lets you reply directly within the email-- but when you reply it will be going to that same email address dedicated to the CST but once the CST service checks your email again and sees that you replied to this inquiry it will log your reply against the customer's case and sends your reply via email back to them so that all the correspondance gets logged on BC's CRM but you can still reply via email.
    There's no way to use the default web forms to update the "From" or "Reply-To" address.. it must come from an approved email address to avoid spam issues.  On most web services you cannot change the "from" address anyway but usually you can at least specify the "Reply-To" address so that when someone hits "reply" in their email client it will reply to whoever you setup as the "Reply-To" address.
    Here's some more information about CST: http://kb.worldsecuresystems.com/kb/customer-service-ticketing.html?bc-partner
    I don't think the CST feature is in the webMarketing BC plan-- I think it's only in the webCommerce plan so if you have less than an webCommerce plan you have to tell your client to reply through BC by clicking the link in the notification they get.  You can justify it by saying its one or two more steps but it keeps the entire convo on record in their CRM for easy referral later.

  • Extension type for mime-type "multipart/form-data"

              Hello:
              If I want to register a mime-type of type "multipart/form-data" in WebLogic 6.0
              what, if any, extension should I specify fot it in the web.xml? Is it necessary
              to specify this mime-type for handling "multipart/form-data" type http requests?
              Thanks
              John
              

    You cannot use request.getParameter() for Multipart/form-data.
              You need to Use getInputStream and use the InputStream to read data.
              Please Refer Jeason Hunters Implementation for the same. Its a very good example.
              Kumar.
              John Buckley wrote:
              > Hmm. Strange. When I send in a multipart/form-data request and when I try to do
              > a request.getParameter within my servlet it returns null and also throws a socket
              > exception at the server console.
              >
              > Any ideas?
              >
              > John
              >
              > Mettu Kumar <[email protected]> wrote:
              > >I don't think its neccesary as I am able to run my code with wls6.0 without
              > >registering
              > >multipart/form-data.
              > >
              > >kumar.
              > >John Buckley wrote:
              > >
              > >> Hello:
              > >> If I want to register a mime-type of type "multipart/form-data" in
              > >WebLogic 6.0
              > >> what, if any, extension should I specify fot it in the web.xml? Is
              > >it necessary
              > >> to specify this mime-type for handling "multipart/form-data" type http
              > >requests?
              > >>
              > >> Thanks
              > >>
              > >> John
              > >
              

  • ALSB 2.5 - routing request containing multipart/form-data

    Hello,
    I'm having difficulty routing a request (multipart/data-form with 2 MIME sections) in a
    business service.
    First, I set up the "attachments" variables in a stage:
    <ctx:attachments>
    <ctx:attachment>
    <ctx:Content-Disposition>form-data; name="RI"; filename="RI"</ctx:Content-Disposition>
    <ctx:Content-Type>text/plain</ctx:Content-Type>
    <ctx:Content-ID>1146702408781_1</ctx:Content-ID>
    <ctx:body>
    <RI/>
    </ctx:body>
    </ctx:attachment>
    <ctx:attachment>
    <ctx:Content-Disposition>form-data; name="CI"; filename="CI"</ctx:Content-Disposition>
    <ctx:Content-Type>text/plain</ctx:Content-Type>
    <ctx:Content-ID>1146702408781_1</ctx:Content-ID>
    <ctx:body>
    <CI/>
    </ctx:body>
    </ctx:attachment>
    </ctx:attachments>
    then do node replacements of <RI/> and <CI/> in each
    <ctx:body> section.
    Then in the routing node,
    "Set Transport Headers" for "Outbound Request"
    [x] Pass all Headers through Pipeline
    Add Header
    [Content-Type] --> [Set Header to "multipart/form-data"]
    Then I used Ethereal (network protocol analyzer) to
    observe the raw packets that business service sent
    the request to the target service. It looked like
    the POST httprequest output by ALSB does not conform to
    the other posting programs that I have wrote in Python
    and Ruby. The target webservice rejects the request
    sent by ALSB, but accepts those sent by the Python/Ruby
    programs.
    Anyone here have any experience in how to set this up?
    Thanks
    Charles

    Hello,
    Make sure you construct the attachment variable properly as specified in the documentation:
    http://e-docs.bea.com/alsb/docs26/userguide/context.html#wp1052039
    Gregory Haardt
    ALSB Prg. Manager
    [email protected]

  • Very big problem with JSF about FORM and "id=" for HTML form's elements and

    I have discovered a very big problem with JSF about FORM and "id=" for HTML form's elements and java instruction "request.getParameterNames()".
    Suppose you have something like this, to render some datas form a Java Beans :
    <h:dataTable value="#{TablesDb2Bean.myDataDb2ListSelection}" var="current" border="2" width="50%" cellpadding="2" cellspacing="2" style="text-align: center">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:outputText id="nameTableDb2" value="#{current.db2_name_table}"/>
    </h:column>
    </h:dataTable>
    Everything works fine...
    Suppose you want to get the name/value pairs for id="nameTableDb2" and #{current.db2_name_table} to process them in a servlet. Here is the HTML generated :
    <td><span <span class="attribute-name">id=<span class="attribute-value">"j_id_jsp_1715189495_22:0:nameTableDb2">my-table-db2-xxxxx</span></td>
    You think you can use the java instructions :
    Enumeration NamesParam = request.getParameterNames();
    while (NomsParam.hasMoreElements()) {
    String NameParam = (String) NamesParam.nextElement();
    out.println("<h4>"++NameParam+ "+</h4>);
    YOU ARE WRONG : request.getParameterNames() wants the syntax *name="nameTableDb2" but JSF must use id="nameTableDb2" for "<h:outputText"... So, you can't process datas in a FORM generated with JSF in a Servlet ! Perhaps I have made an error, but really, I wonder which ?
    Edited by: ungars on Jul 18, 2010 12:43 AM
    Edited by: ungars on Jul 18, 2010 12:45 AM

    While I certainly appreciate ejb's helpful responses, this thread shows up a difference in perspective between how I read the forum and how others do. Author ejb is correct in advising you to stay inside JSF for form processing if form processing is what you want to do.
    However, I detect another aspect to this post which reminds me of something Marc Andreesen once said when he was trying to get Netscape off the ground: "there's no such thing as bad HTML."
    In this case, I interpret ungar's request as a new feature request. Can I phrase it like this?
    "Wouldn't it be nice if I could render my nice form with JSF but, in certain cases, when I REALLY know what I'm doing" just post out to a separate servlet? I know that in this case I'll be missing out on all the nice validation, conversion, l10n, i18n, ajax, portlet and other features provided by JSF".
    If this is the case, because it really misses the point of JSF, we don't allow it, but we do have an issue filed for it
    https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=127
    If you can't wait for it to be fixed, you could decorate the FormRenderer to fix what you want.
    I have an example in my JSF book that shows how to do this decoration. http://bit.ly/edburnsjsf2
    Ed

  • Multiple select multipart/form-data + FileUploader

    Hi
    I'm using asp multiple select form field with
    multipart/form-data +
    FileUploader to upload a file (works fine) and writing the
    contents of
    a form to a database which works fine apart from the multiple
    select
    which although allows me to select multiple items only
    returns the
    first selected item to the database.
    Anywork arounds to this??
    Thanks in advance!!
    Buzby
    There's nothing more dangerous than a resourceful idiot

    Multi-part requests are not packaged the same as regular requests, so the getParameter() method doesn't work on it (although I think it would get anything passed through the query string as part of the action parameter but I'm not sure).
    You can also try the com.oreilly.servlet class MultipartRequest. I don't know if that's the same one found in the www.servlets.com link, but it is REALLY easy. Essentially, it looks like this:
    MultipartRequest mr = new MultipartRequest(request, "[pathtosavefiles]'");
    String param = mr.getParameter("paramname");
    So instead of calling getParameter() on the request object, you now instead call it on the MultipartRequest object. When you instantiate the MultipartRequest object, it parses the request body for you, and also saves any uploaded files into the directory you specified in your path in the constructor.
    I hope that helps.
    Michael

  • Problems with Submitting the form

    Hey Guys,
    I have a form with 7 different fields. my form is connected with the database. once the user fills out the information and clicks on submit the entry should be saved in the database.
    Everything is working fine. i can establish connection with the database. my only problem is that when i click on submit its not adding the entry in the database. I think i have problems with this command
    <form method = "post" > . Any helpo will be really appreciated. I am posting some part of the code.
    <%!
      public void jspInit() {
        try {
          Class.forName("org.apache.derby.jdbc.ClientDriver");
          System.out.println("JDBC driver loaded");
        catch (ClassNotFoundException e) {
          System.out.println(e.toString());
    <body>
    <%
    String name, unit, title, supervisor, region, dept, date;
    %>
    <p align="center"><b><font size="5" face="Arial">LOGIN REQUEST FORM </font></b>
    <form method="POST">
    <p align="left"><b><font size="2">                           
         </b>Name:<b> <input type="text" name="name" size="20">   </b>Title   <b>
         <input type="text" name="title" size="20">         </b> Dept <b>         
         <input type="text" name="dept" size="20"></b></font></p>
         <p align="left"><font size="2"><b>                 
         </b>Supervisor: <b> <input type="text" name="supervisor" size="20"> </b>Region<b> 
         <input type="text" name="region" size="20">  </b>Business Unit<b>
         <input type="text" name="unit" size="20"></b></font></p>
         <p align="left"><font size="2"><b>              </b>
         Effective Date:<b> <input type="text" name="date" size="20"></b></font></p>
         <input type = "reset">
         <input type = "submit">
         <%
         name = request.getParameter("name");
         unit = request.getParameter("unit");
         title = request.getParameter("title");
         supervisor = request.getParameter("supervisor");
         region = request.getParameter("region");
         dept = request.getParameter("dept");
         date = request.getParameter("date");
         boolean error = false;
         String message = null;
         try {
              Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/sample");
              System.out.println("Connection Established");
              Statement s = con.createStatement();
              String sql = "SELECT name FROM users" +
              "WHERE name='" + name + "'";
              ResultSet rs = s.executeQuery(sql);
              if(rs.next()) {
                   rs.close();
                   message = "The username <B>" + encodeHtmlTag(name) + "</B> has already been taken. Please select another name.";
                   error = true;
              else {
                   rs.close();
                   sql = "INSERT INTO user" +
                   "(name, unit, title, supervisor, region, dept, date)" +
                   "VALUES" +
                   "('" + name + "'," + " '" + unit + "'," + " '" + title + "'," + " '" + supervisor + "',"
                   + " '" + region + "'," + " '" + dept + "'," + " '" + date + "')";
                   int i = s.executeUpdate(sql);
                   if(i==1) {
                        message = "User Added";
              s.close();
              con.close();
         catch(SQLException e) {
              message = "Error " + e.toString();
         catch(Exception e) {
              message = "Error" + e.toString();
              error = true;
         %>
    </form>
    </body>
    </html>

    Even if there was an exception being thrown, you wouldn't see it because you're catching it but not doing anything with the message:
    catch(SQLException e) {
              message = "Error " + e.toString();
         catch(Exception e) {
              message = "Error" + e.toString();
              error = true;
         }Try changing this part to:
    catch(SQLException e) {
              message = "Error " + e.toString();
                    e.printStackTrace();
         catch(Exception e) {
              message = "Error" + e.toString();
              error = true;
                    e.printStackTrace();
         }

Maybe you are looking for