You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Maini, Puneet (Cognizant)" <Pu...@pun.cognizant.com> on 2003/04/24 12:28:28 UTC
Storing UTF-8 data with multipart/form-data
I'm storing Japanese characteres in the database & then display the same on JSP.
The changes I've done to achieve this are:
* Added following in JSP
<%@ page contentType="text/html; charset=UTF-8"%>.
* Added following in JSP/HTML
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
* Set the encoding type of Container to UTF-8
Everything works fine & I'm able to store data in Japanese & can also display the same properly till this problem came.
I'm trying to upload a file & so I specified the enctype as "multipart/form-data;charset=UTF-8"
<html:form action="/test.do" method="post" name="FormName" type="com.test.bean.LoadActionForm"
enctype = "multipart/form-data;charset=UTF-8">
If I remove the "charset=UTF-8" from the enctype, data does not get saved properly in Japanese.
And after adding it the following exception came:
============================ Start Exception Trace =================================
[4/24/03 14:36:57:910 GMT+05:30] 7da513b2 WebGroup E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:988)
at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:904)
at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.dfs.internet.common.DFSControllerServlet.service(DFSControllerServlet.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java(Compiled Code))
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java(Compiled Code))
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java(Compiled Code))
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
============================ End Exception Trace =================================
I'm using Struts Stable Release (1.0.2).
Any help or idea to overcome this probelm would be highly appreciated.
Thanks & Regards,
-- Puneet Maini