Carl Smith wrote:
I am having issues to get the request parameters from a multipart request, le 
me explain my problem first:

Our flow of process is:

(1) a multipart request is submitted to a struts action (let's say 
updateTableAction.do) using POST

(2) the multipart request is processed by ActionServlet.process() method

(3) in our processPreprocess method, which overrides processPreprocess in 
RequestProcessor.java from struts,

we need the parameters from this multipart request thus I am doing this:

CommonsMultipartRequestHandler commonMultiPartHandler = new CommonsMultipartRequestHandler();


try {

commonMultiPartHandler.handleRequest(request);

}catch(Exception e){

// some handling

}

Hashtable ht = commonMultiPartHandler.getTextElements(); // thus I get the 
parameters from the request

(4) however, all the fields/parameters in multipart request are no longer there 
in the updateTableAction.do

Can you help me find out why this is happening? One theory is that a multipart 
request can't be parsed twice. Is this correct, if it is correct, do you have 
any alternative?

That's certainly true; once the request has been consumed (parsed) it can't be parsed again since the data is no longer there. I don't know the normal flow of RequestProcessor but I assume you need to store the result of handleRequest() in the same way as Struts normally does -- probably using an HttpRequestWrapper. If that's not normally handled in processPreprocess(), you'll need to also override whichever method in RequestProcessor does handle it.

L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to