Vijay Kumar Khushlani
Vijay Kumar Khushlani

Reputation: 35

multipart/form-data used with characters for access jsp

Can Any Buddy Tell me that how to use characters of data with multipart/form-data in from attribute . i knows that multipart/form-data is used when forms that have a file upload control but i won't to use both characters and file upload control . when i use multipar i can't able to transfer my characters .
HOW I USE BOTH ???
In the Html page -

<form enctype="multipart/form-data" method=post action='upload.jsp'>
<select name="year"><option>Year 1</option><option>Year 2</option></select>
Browes Your .xml File<input type='file' name='fname' accept='text/xml'>
<input type='submit' value='Upload'/>

jsp page -

<%@page import="com.oreilly.servlet.MultipartRequest" %>
<%
  MultipartRequest mpr=new MultipartRequest(request,"C://upload");
  request.getParameter("year");                   // Return Null Here
%>

how i get the parameter value of year here ??

Upvotes: 0

Views: 1086

Answers (1)

Ray Stojonic
Ray Stojonic

Reputation: 1270

Once you have an enctype of multipart/form-data, the request becomes multipart and the form data won't be accessible via the implicit request jsp object.

Use the MultipartRequest you set up:

mpr.getParameter( "year" );

Upvotes: 1

Related Questions