Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MultipartRequest and Tag Libraries

Status
Not open for further replies.

tinac99

Programmer
Jan 17, 2002
58
US
Hi,

I have a JSP which is supposed to upload a file while storing other database information.

JSP
---
<form action="transcription" name="transcription" method="post" enctype="multipart/form-data">
<abc:text_input type="text" name="firstname"/>
<abc:text_input type="text" name="lastname"/>
<input type="file" name="attachment" />
</form>

In the Servlet, I use the MultipartRequest to get the value of the parameters:

Servlet
--------
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
beginRequest(request, response);
try
{
if (request.getMethod().equals("POST") && request.getContentType().startsWith("multipart/form-data"))
{
try
{
User user = getUser(request);

MultipartRequest parser = new ServletMultipartRequest(request, MultipartRequest.MAX_READ_BYTES * 10);

String action = this.getActionFromMultipartRequest(parser, "");

String lastname = parser.getURLParameter("lastname"),
String firstname = parser.getURLParameter("firstname"),

}
}
}
finally
{
endRequest();
}
}




Tag library
------------
text_inputTag.java
--------------------
Is there a way to get value of the lastname and firstname if I get it from the MutilpartRequest?

Thanks,

CeCe

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top