BeanUtils.Populate() servletException

Will anyone tell me why this error is coming.
I am using it in struts programming, (In this program i'm using validator.xml also but that is working but when it goes to form action it is showing error)i had imported the beanutils.jar files also but i'm not able to track the error so if anyone knows the answer please reply. Thanks for helping in advance...
Rose.

Thank you very much. Four years later and that advice still helped me.
You are probably missing an 'enctype' attribute on
your <html:form> tag. Try this:
<html:form ... enctype="multipart/form-data">
ou must use multipart/form-data when using upload
fields. If not, you will get the BeanUtils.populate()
exception when you submit the form.

Similar Messages

  • Javax.servlet.ServletException: BeanUtils.populate

    hi all,
    anyone know why this error is coming
    thnx

    I have got the below exception while using multipart form data in struts.
    javax.servlet.ServletException: BeanUtils.populate
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:534)

  • BeanUtils.populate exception (Need Help)

    Dear All,
    Am getting a strange exception when try to do a action in struts, below is my exception, please help me in solving this issue.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1190)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    root cause
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
         java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         java.security.AccessController.checkPermission(AccessController.java:427)
         java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
         java.lang.Class.checkMemberAccess(Class.java:2125)
         java.lang.Class.getDeclaredMethods(Class.java:1762)
         org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
         org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
         org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
         org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
         org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:991)
         org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:343)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1188)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Thanks in advance,
    vyrav.

    Thanks for ur reply Ganesh.
    This is my JSP
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html:html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Uploaded File Details</title>
         <script>
              function logOut()
                        document.adminForm.action="upload.do?parameter=logout";
                        document.adminForm.submit();
              function download(temp)
                        document.adminForm.fileId.value = temp;
                        document.adminForm.action="download.do";
                        document.adminForm.submit();
         </script>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
         <table align="right">
                        <tr>
                             <td>
                                  <a href="javascript:logOut();">Logout</a>
                             </td>
                        </tr>
         </table>
         <%
                        if(session.getAttribute("name")!=null)
                                    String userName= (String) session.getAttribute("name");
         %>
                   <br /><br /><b>Welcome <%=userName%></b><br />
         <%
         %>
         <center>
              <html:form action="/download.do" name="adminForm" type="com.roots.AdminForm">
                   <br /><br />
                   <html:hidden property="fileId"/>
                   <table align="center" border="1">
                        <tr bgcolor="#FFCC66">
                             <td align="center">
                                  No
                             </td>
                             <td align="center">
                                  Name
                             </td>
                             <td align="center">
                                  Uploaded Date
                             </td>
                             <td align="center">
                                  File Name
                             </td>
                        </tr>
                        <logic:iterate name="adminForm" property="displayList" id="displayDto">
                             <tr>
                                  <td align="center">
                                       <bean:write name="displayDto" property="serialNo"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="empName"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="uploadedDate"/>
                                  </td>
                                  <td align="left">
                                       <a href="javascript:download('<bean:write name="displayDto" property="serialNo"/>');"><bean:write name="displayDto" property="fileName"/></a>
                                  </td>
                             </tr>
                        </logic:iterate>
                   </table>
              </html:form>          
         </center>
    </body>
    </html:html>This is my struts config
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
             "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
             "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
         <struts-config>
               <data-sources>
               </data-sources>
              <form-beans>
                   <form-bean name="loginForm" type="com.roots.LoginForm" />
                   <form-bean name="uploadForm" type="com.roots.UploadForm" />
                   <form-bean name="adminForm" type="com.roots.AdminForm" />
              </form-beans>
              <global-forwards></global-forwards>
              <action-mappings>
                   <action path="/login"
                        name="loginForm"
                        scope="request"
                        validate="true"
                        input="/login.jsp"
                        type="com.roots.LoginAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                             <forward name="ADMIN" path="/admin.do" />
                   </action>
                   <action path="/upload"
                        name="uploadForm"
                        scope="request"
                        parameter="parameter"
                        input="/upload.jsp"
                        type="com.roots.UploadAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                   </action>
                   <action path="/download"
                             type="com.roots.FileDownloadAction">
                   </action>
                   <action path="/admin"
                        name="adminForm"
                        scope="request"
                        validate="false"
                        type="com.roots.AdminAction" >
                        <forward name="DISPLAY" path="/admin.jsp" />
                        <forward name="FAILURE" path="/login.jsp" />
                   </action>
              </action-mappings>
              <message-resources parameter="application_fr"/>
            <message-resources parameter="application_es"/>
            <message-resources parameter="application_en"/>
            <message-resources parameter="application_de"/>
            <message-resources parameter="application" />
         </struts-config>this is my form package com.roots;
    import java.util.List;
    import org.apache.struts.action.ActionForm;
    public class AdminForm extends ActionForm {
         private List displayList = null;
         public String fileId;
         public String getFileId() {
              return fileId;
         public void setFileId(String fileId) {
              this.fileId = fileId;
         public List getDisplayList() {
              return displayList;
         public void setDisplayList(List displayList) {
              this.displayList = displayList;
    }Please let me know wat am doing wrong, this is killing me for the last two days.
    Thanks,
    vyrav.

  • BeanUtils populate

    Hi,
    I am populating a bean in a servlet from request parameters using the BeanUtils.populate method.
    This works fine mostly. The problem i am having is getting it to populate nested beans?
    Example.
    public User setUser(User u){
    user = u;
    the way i am populating is like this
    HashMap map = new HashMap();
    Enumeration names = request.getParameterNames();
    while (names.hasMoreElements()) {
    String name = (String) names.nextElement();
    map.put(name, request.getParameterValues(name));
    BeanUtils.populate(bean, map);
    Thanks for anyones help.
    Paul

    Hi,
    I am populating a bean in a servlet from request parameters using the BeanUtils.populate method.
    This works fine mostly. The problem i am having is getting it to populate nested beans?
    Example.
    public User setUser(User u){
    user = u;
    the way i am populating is like this
    HashMap map = new HashMap();
    Enumeration names = request.getParameterNames();
    while (names.hasMoreElements()) {
    String name = (String) names.nextElement();
    map.put(name, request.getParameterValues(name));
    BeanUtils.populate(bean, map);
    Thanks for anyones help.
    Paul

  • Got error when trying to populate JSP from ActionServlet......Help me

    Hi Guys,
    In My application, I need to search a directory on my machine like if i give abc, it should display all files that match "abc". For that i have a Jsp page which accepts the pattern and am using MVC architecture for developing this application and I got this error when i ran the application. My jsp page:
    <body>
    <html:form action="/searchPattern">
    <TABLE border="0">
    <TBODY>     <TR>
         <TH>File Pattern</TH>
         <TD><html:text property="pattern" /></TD></TR>          <TR><TD><html:submit property="submit" value="Submit" /></TD></TR>
    </TBODY>
    </TABLE>
    </html:form>
    </body>
    another Jsp for displaying the results:
    <body>
    <jsp:useBean class="com.mot.struts.form.SearchForm" id="fileDetail" scope="session"/>
    <table>     
    <tr><td>File Names</td>
         <td><jsp:getProperty name="fileDetail" property="pattern"/></td>
         <td><ul>
         <logic:iterate name="fileDetail" property="listFiles"
         id="fileDetails" scope="session">               
         <li><bean:write name="fileDetails" property="listFiles" />
         </li>                
         </logic:iterate>
         </ul></td>
         </tr>
    </table>
    </body>
    and the Action servlet is:
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response) {
         SearchForm searchForm = (SearchForm) form;
    String pattern=request.getParameter("pattern");
    File dir = new File("D:\\satish\\archive");
    System.out.println("Searching....");               
    File[] children=dir.listFiles();
    for (int i=0; i<children.length; i++) {
    String fileMatch=children.getAbsoluteFile().getName();
    if(fileMatch.contains(pattern)==true){      
    System.out.println("File pattern with .log found, File Name "+ fileMatch);
              request.setAttribute("fileDetail", searchForm);           
    return mapping.findForward("success");
    else{
    System.out.println("File pattern does not found");
    return mapping.findForward("failure");
    and the FormBean is:
    public class SearchForm extends ActionForm {
         private List pattern;
         private List fileName;
         private List listFiles;
         public SearchForm(){          
         public SearchForm(List pattern, List fileName, List listFiles){
              this.pattern=pattern;
              this.fileName=fileName;
              this.listFiles=listFiles;
         public static class Files{          
         private Object fName;
         public Files(){               
         public Files(Object fName){               
         this.fName=fName;
         public Object getFName() {
         return fName;
         public void setFName(Object name) {
         fName = name;
         public List getListFiles() {
         int size=pattern.size();
         List listFiles=new ArrayList(size);
    for( int p = 0; p < size; p++ ) {
         listFiles.add(new Files(fileName.get(p)));
         return listFiles;
         public void setListFiles(List listFiles) {
              this.listFiles = listFiles;
         public List getPattern() {
              return pattern;
         public void setPattern(List pattern) {
              this.pattern = pattern;
         public List getFileName() {
              return fileName;
         public void setFileName(List fileName) {
              this.fileName = fileName;
    and I got the following error:
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
    .........root cause:
    java.lang.IllegalArgumentException: argument type mismatch
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    Plz help me in solving this

    your form bean probably has a property that was declared using the wrong data type

  • Action works on fireFox, BeanUtils error on IE ?!?!?!

    Hi there,
    I have a simple form that works greate on fireFox, but when trying the application on IE - I get this message:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.IllegalArgumentException: No bean specified
         org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937)
         org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.The action in the jsp looks like this:
              <td>
                   <html:image property="proposal.action" value="insert"
                               src="./images/submit.png" />
                                    <br><fmt:message key="button.group.proposal.submit"/>                         
              </td>     does anyone know why it works on fireFox but not on IE?
    thank you

    It is probably a feature of the input type="image" component.
    When submitting this component, it will pass in two request parameters - the x,y co-ordinates of where the image was clicked.
    ie <input type="image" name="proposal.action"
    will submit parameters proposal.action.x=??? and proposal.action.y=???
    In Firefox, it also submits proposal.action=insert (ie the value of the button) IE does not do this.
    That is probably the root cause of the issue.
    Struts does provide the [url http://struts.apache.org/1.2.9/api/org/apache/struts/util/ImageButtonBean.html] ImageButtonBean to use on your action form and determine if a button was clicked. However each individual button would have to have its own name - you can't use it with the DispatchAction so easily.

  • Unable to retrive the uploaded file in Struts

    hi i am getting error while retrieving the uploaded file in struts. The code is
    struts-config.xml
    ===========
    <form-bean name="GreivanceForm" type="org.apache.struts.validator.DynaValidatorActionForm" >
                   <form-property name="compcode" type="java.lang.String" />
                   <form-property name="complaintName" type="java.lang.String" />
                   <form-property name="category" type="java.lang.String" />
                   <form-property name="subcategory" type="java.lang.String" />
                   <form-property name="priority" type="java.lang.String" />
                   <form-property name="occdate" type="java.lang.String" />
                   <form-property name="occtime" type="java.lang.String" />
                   <form-property name="desc" type="java.lang.String" />
                   <form-property name="comments" type="java.lang.String" />
                   <form-property name="onbehalf" type="java.lang.String"/>
                   <form-property name="employeeId" type="java.lang.String"/>
                   <form-property name="hidSelectedNames" type="java.lang.String"/>
                   <form-property name="individual" type="java.lang.String"/>
                   <form-property name="compOption" type="java.lang.String" />
                   <form-property name="selectedrequestor" type="java.lang.String" />
                   <form-property name="file" type="java.lang.String"/>
              </form-bean>
    <action path="/helpdesk/GrievanceComplaint"
                   type="com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintAction"
                   scope="request" name="GreivanceForm"
                   input=""
                   validate="true"
                   parameter="compOption" >
                   <forward name="success" path="/helpdesk/GrievanceRedressalMechanism/ComplaintDetails.jsp"/>
                   <forward name="showmeetingform" path="/helpdesk/complaint/MeetingDetailsForm.jsp"/>
                   <forward name="transconfirm" path="/helpdesk/GrievanceRedressalMechanism/TransConfirm.jsp"/>
                   <forward name="ViewCompForm" path="/helpdesk/GrievanceRedressalMechanism/ViewCompForm.jsp"/>
              </action>
    and
    Actionclass:
    ========
    * Created on Nov 5, 2004
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package com.srit.hrnet.helpdesk.grievancemechanism;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import java.util.List;
    import java.util.StringTokenizer;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import org.apache.commons.beanutils.BeanUtils;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    import org.apache.struts.action.ActionMessages;
    import org.apache.struts.action.DynaActionForm;
    import org.apache.struts.actions.DispatchAction;
    import org.apache.struts.upload.FormFile;
    import org.apache.struts.validator.DynaValidatorActionForm;
    import org.apache.struts.validator.DynaValidatorForm;
    import com.srit.hrnet.components.SequenceCodeGenerator;
    import com.srit.hrnet.emp.EmployeeGenTO;
    import com.srit.hrnet.emp.courier.CourierMailDAO;
    import com.srit.hrnet.emp.courier.CourierMailTO;
    import com.srit.hrnet.emp.parameter.ParamMasterTO;
    import com.srit.hrnet.helpdesk.SessionValidate;
    import com.srit.hrnet.helpdesk.category.CategoryDAO;
    import com.srit.hrnet.helpdesk.category.CategoryTO;
    import com.srit.hrnet.helpdesk.mails.HDMail;
    import com.srit.hrnet.utilities.DateUtilities;
    import com.srit.hrnet.helpdesk.complaint.TaskDAO;
    import com.srit.hrnet.helpdesk.SessionValidate;
    import com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintForm;
    public class GrievanceComplaintAction extends DispatchAction{
         public ActionForward submitForm(ActionMapping mapping,
                   ActionForm form, HttpServletRequest request,
                   HttpServletResponse response)throws ServletException,IOException {  
                   String msg=null;
                   DynaValidatorActionForm objDyna = (DynaValidatorActionForm)form;
                   GrievanceComplaintDAO gcDao= new GrievanceComplaintDAO();
              ActionForward forward = new ActionForward();
    //          GrievanceComplaintForm gcForm=(GrievanceComplaintForm)form;
                        String CompId = null;
              try
                             SequenceCodeGenerator seq=new SequenceCodeGenerator("GrievanceMechanism");
                             CompId=seq.generateCode();
                   GrievanceComplaintTO gcTO=new GrievanceComplaintTO();
                   System.out.println("Inside GrievanceComplaintAction ......");
                   String CompName=request.getParameter("complaintName");
                   String Category=request.getParameter("category");
                   String prority=request.getParameter("priority");
                   String dateofocc=request.getParameter("occdate");
                   String timeofocc=request.getParameter("occtime");
                   String desc=request.getParameter("desc");
                   String comments=request.getParameter("comments");
    //          String file=request.getParameter("file");
    //          String complaintcode = .generateCode();
                   System.out.println("Inside insert()::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
                   System.out.println("Name Of the Complaint name>>>>>>>>>>>>>>"+CompName);
                   System.out.println("Name Of the Categoryt>>>>>>>>>>>>>>"+Category);
                   System.out.println("Name Of the prority>>>>>>>>>>>>>>"+prority);
                   System.out.println("Name Of the dateofocc>>>>>>>>>>>>>>"+dateofocc);
                   System.out.println("Name Of the timeofocc>>>>>>>>>>>>>>"+timeofocc);
                   System.out.println("Name Of the desc>>>>>>>>>>>>>>"+desc);
                   System.out.println("Name Of the comments>>>>>>>>>>>>>>"+comments);
    //          System.out.println("Name Of the file>>>>>>>>>>>>>>"+file);
                   GregorianCalendar occdate=DateUtilities.getGCDateForString(objDyna.getString("occdate"),((com.srit.hrnet.emp.EmployeeGenTO)request.getSession().getAttribute("LoginUser")).getDateFormat(),'/');
                   gcTO.setComplaintCode(CompId);
                   gcTO.setComplaintName(CompName);
                   gcTO.setCategory(Category);
                   gcTO.setPriority(prority);
                   gcTO.setOccdate(occdate);
                   System.out.println("After Setting date in GTO is>>>>>>>>>>>>>>"+gcTO.getOccdate());
                   gcTO.setOcctime(timeofocc);
                   gcTO.setDesc(desc);
                   gcTO.setComments(comments);
                        HDMail mailComp = new HDMail();
                   String errorFlag = null;
                   String filePath = ""+objDyna.get("file");// Attachment path
                   StringTokenizer st=new StringTokenizer(filePath,".");
                   String extension=null;
    //               String filename=null;
                   String attachmentPath = null;
                   while(st.hasMoreTokens())
                        extension=st.nextToken();
    //          while(st1.hasMoreTokens()){
    //               filename=st1.nextToken();
                   System.out.println("Attachment path : "+attachmentPath);
              System.out.println("Extension is.........."+extension);
    //          System.out.println("Name of the file is.............."+filename);
              if(filePath != null && filePath.indexOf(".") != -1 && filePath.length()>=5 ){// If attachment exists
    //               attachmentPath = filePath.substring(filePath.indexOf(".")+1,filePath.length());// file extension
    ////               System.out.println("Attachment path : "+attachmentPath);
                   if(!extension.equalsIgnoreCase("txt") && !extension.equalsIgnoreCase("htm")
                             &&!extension.equalsIgnoreCase("doc") &&!extension.equalsIgnoreCase("rtf")
                                       &&!extension.equalsIgnoreCase("msg") &&!extension.equalsIgnoreCase("oft")
                                       && !extension.equalsIgnoreCase("xls")){
                        errorFlag = "1"; // if the file is not a valid type (not in the above mentioned extensions)
              gcTO.setAttachmentName(filePath);
              if(errorFlag.equals("1")){
    //          String attachmentName = null;
    ////          String attachmentPath = request.getParameter("agendaAttachment");
    //          DynaValidatorForm dyna=(DynaValidatorForm)form;
    //                         FormFile file= (FormFile)objDyna.get("file");
    //                         //dyna.get("file");      
    //          System.out.println("Name of the file after casting....."+file.getFileName());
    //                         if(file!=null && file.getFileName()!=null && !file.getFileName().trim().equals("")){
    //                              String fileName = null;                         
    //                              fileName = file.getFileName();
    //                              attachmentName = fileName;
    //                              if(validFile(fileName))
    //                              writeFile(file,request,fileName);
    //                              else
    //                                   ActionMessages errors=new ActionMessages();
    //                                   errors.add("Err:MsgDesc",new ActionMessage("com.srit.hrnet.helpdesk.complaint.form.fileupload"));                              
    //                                   saveErrors(request,errors);                         
    ////                                   ActionForward map1 = submitSubCategory(mapping,form,request,response);                              
    //                                   resetToken(request);     
    //                                   saveToken(request);
    //                                   return mapping.findForward("ViewCompForm");                              
    //                    int recordexists = gcDao.getComplaint(CompId);
    //                    if(recordexists == 1){
    //                         System.out.println("Calling the update method");
    //                         gcDao.updateComplaintDetails(gcTO);     
    //                    }else{
                        boolean retVal=gcDao.insert(gcTO);
              if (retVal){
                   System.out.println("Record Inserted inside Action.");
                   msg = "<font color='blue'>Record Inserted Successfully .</font>";
                             request.setAttribute("status", msg);
              else{
                   System.out.println("Unable to insert Record inside Action.");
                   msg = "<font color='red'>Unable to insert Record .</font>";
                             request.setAttribute("status", msg);
              else
                   System.out.println("Upload a file of extension(.jpg,.gif,.doc,.htm,.xls,.rtf,oft,msg) inside Action.");
                   msg = "<font color='red'>Upload a file of extension(.jpg,.gif,.doc,.htm,.xls,.rtf,.oft,.msg) </font>";
                             request.setAttribute("status", msg);
              catch (Exception e) {
                   // TODO: handle exception
                   System.out.println("Exception Occurred inside insert action....."+e.getMessage());
                   e.printStackTrace();
    //          else
    //               String insStatus="10";
    //               System.out.println("Accept:Redirecting due to resubmission");
    //               request.setAttribute("transStatus",insStatus);
    //               forward =mapping.findForward("transconfirm");
                   return mapping.findForward("success");
         public boolean validFile(String fileName){
              if(!fileName.equals("")){     
                        int filelength=fileName.length();
                        int sublength= fileName.indexOf('.');
                        String extension = fileName.substring(sublength+1,filelength);
                        if(extension.trim().equalsIgnoreCase("msg") || extension.trim().equalsIgnoreCase("txt") || extension.trim().equalsIgnoreCase("xls") || extension.trim().equalsIgnoreCase("ppt") || extension.trim().equalsIgnoreCase("jpg") || extension.trim().equalsIgnoreCase("gif")|| extension.trim().equalsIgnoreCase("doc" )|| extension.trim().equalsIgnoreCase("pdf") || extension.trim().equalsIgnoreCase("wmv") || extension.trim().equalsIgnoreCase("zip") || extension.trim().equalsIgnoreCase("jpeg") || extension.trim().equalsIgnoreCase("xml") || extension.trim().equalsIgnoreCase("html") ||extension.trim().equalsIgnoreCase("bmp") ||extension.trim().equalsIgnoreCase("htm") ||extension.trim().equalsIgnoreCase("ppt")||extension.trim().equalsIgnoreCase("oft")||extension.trim().equalsIgnoreCase("csv")){
                        return true;
                        }else{
                        return false;
                   return true;
         public int writeFile(FormFile file,HttpServletRequest request,String fileName){
                   int retValue = 0;
                   String size = (file.getFileSize() + " bytes");
                   if(file.getFileSize()>0){
                        //System.out.println("The size of the file is :" + file.getFileSize() + " bytes");
                        String data = null;
                        try {
                             //retrieve the file data
                             String fileTodelete = request.getRealPath("/helpdesk/meetingsagenda/"+fileName);
                             boolean success = (new File(fileTodelete)).delete();
                             //System.out.println("sucess......"+success);          
                             ByteArrayOutputStream baos = new ByteArrayOutputStream();
                             InputStream stream = file.getInputStream();
                             //write the file to the file specified
                             System.out.println("sfsdfkjdsfds "+request.getRealPath("/helpdesk/meetingsagenda/"+fileName));
                             OutputStream bos = new FileOutputStream(request.getRealPath("/helpdesk/meetingsagenda/"+fileName));
                             int bytesRead = 0;
                             byte[] buffer = new byte[8192];
                                  while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
                                       bos.write(buffer, 0, bytesRead);
                             bos.close();
                             data =      "The file has been written to \""+ "/helpdesk/meetingsagenda/"+ "\"";
                             System.out.println("data........."+data);
                                  //close the stream
                             stream.close();
                        }catch(FileNotFoundException fnfe) {
                                  System.out.println("com.srit.hrnet.homepage.fromceo.FromCEOAction.writeFile.Exception :"+ fnfe.toString());
                                  fnfe.printStackTrace();
                                  //retValue = FORMFILE_FILE_NA;
                        }catch(IOException ioe) {
                                  System.out.println("com.srit.hrnet.homepage.fromceo.FromCEOAction.writeFile.Exception :"+ ioe.toString());
                                  ioe.printStackTrace();
                                  //retValue = FORMFILE_ERR_UPD;
                   }//end of try catch:~
                   }else{
                        //The file was a not available
                        //retValue = FORMFILE_SIZE_ZERO;
                   }//end of if else:~
              //     System.out.println("retValue........."+retValue);
                   return retValue;                         
    }//end of ComplaintAction
    and GrievanceFormTO:(Dummy form bean)
    ==========
    * Created on Nov 4, 2004
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package com.srit.hrnet.helpdesk.grievancemechanism;
    import java.util.GregorianCalendar;
    import org.apache.struts.upload.FormFile;
    public class GrievanceComplaintTO implements java.io.Serializable {
    private String complaintCode;
    private String compcode; //complaind Id
    private String complaintName;
    private String category;
    private String priority;
    //private GregorianCalendar date;
    private FormFile theFile;
    private String compOption;
    private String desc;
    private String comments;
    private String status;
    private String serviceperson;     //employee who is going to serve the complaint.Applicatble only in case of manual flow.
    private String loggedEmpId; //the employee who has logged the complaint
    private String applyEmpId; //employee to whom the cmplaint belongs to or owner of the complaint
    private String associateComm;
    private String associateRating;
    private GregorianCalendar occdate;
    private String occtime;
    private String attachmentName;
         public String getApplyEmpId() {
              return applyEmpId;
         public void setApplyEmpId(String applyEmpId) {
              this.applyEmpId = applyEmpId;
         public String getAssociateComm() {
              return associateComm;
         public void setAssociateComm(String associateComm) {
              this.associateComm = associateComm;
         public String getAssociateRating() {
              return associateRating;
         public void setAssociateRating(String associateRating) {
              this.associateRating = associateRating;
         public String getCategory() {
              return category;
         public void setCategory(String category) {
              this.category = category;
         public String getComments() {
              return comments;
         public void setComments(String comments) {
              this.comments = comments;
         public String getCompcode() {
              return compcode;
         public void setCompcode(String compcode) {
              this.compcode = compcode;
         public String getComplaintName() {
              return complaintName;
         public void setComplaintName(String complaintName) {
              this.complaintName = complaintName;
         public String getCompOption() {
              return compOption;
         public void setCompOption(String compOption) {
              this.compOption = compOption;
         public String getDesc() {
              return desc;
         public void setDesc(String desc) {
              this.desc = desc;
         public String getLoggedEmpId() {
              return loggedEmpId;
         public void setLoggedEmpId(String loggedEmpId) {
              this.loggedEmpId = loggedEmpId;
         public String getOcctime() {
              return occtime;
         public void setOcctime(String occtime) {
              this.occtime = occtime;
         public String getPriority() {
              return priority;
         public void setPriority(String priority) {
              this.priority = priority;
         public String getServiceperson() {
              return serviceperson;
         public void setServiceperson(String serviceperson) {
              this.serviceperson = serviceperson;
         public String getStatus() {
              return status;
         public void setStatus(String status) {
              this.status = status;
         public String getComplaintCode() {
              return complaintCode;
         public void setComplaintCode(String complaintCode) {
              this.complaintCode = complaintCode;
         public void setOccdate(GregorianCalendar occdate) {
              this.occdate = occdate;
         public GregorianCalendar getOccdate() {
              return occdate;
         public String getAttachmentName() {
              return attachmentName;
         public void setAttachmentName(String attachmentName) {
              this.attachmentName = attachmentName;
         public FormFile getTheFile() {
              return theFile;
         public void setTheFile(FormFile theFile) {
              this.theFile = theFile;
    but i am getting error
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.srit.hrnet.filter.SessionValidateFilter.doFilter(SessionValidateFilter.java:81)
    root cause
    org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile' to property 'file' of type 'java.lang.String'
         org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:424)
         org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1733)
         org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
         org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
         org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.srit.hrnet.filter.SessionValidateFilter.doFilter(SessionValidateFilter.java:81)
    and my jsp is:
    =========
    <%@ page language="java" %>
    <%@ taglib uri="struts-bean" prefix="bean" %>
    <%@ taglib uri="struts-html" prefix="html" %>
    <%@ taglib uri="struts-logic" prefix="logic" %>
    <%@ taglib uri="TabGenerator" prefix="GenerateTab" %>
    <%@ page import="com.srit.hrnet.utilities.DateUtilities"%>
    <%@ page import="com.srit.hrnet.components.BasicDAOConstants" %>
    <%@ taglib uri="AccessLogin" prefix="GeneralAccess" %>
    <%@ taglib uri="iterateTag" prefix="iterateTag" %>
    <%@ page import="com.srit.hrnet.components.BasicDAOConstants,com.srit.hrnet.emp.EmployeeGenTO,com.srit.hrnet.helpdesk.grievancemechanism.*"%>
    <%@ page import="com.srit.hrnet.tags.*"%>
    <html:html locale="true">
    <HEAD>
         <TITLE>
                   <bean:message key="com.srit.hrnet.helpdesk.complaint.form.title"/>
         </TITLE>
         <META NAME="Generator" CONTENT="EditPlus">
         <META NAME="Author" CONTENT="">
         <META NAME="Keywords" CONTENT="">
         <META NAME="Description" CONTENT="">
    <link rel="stylesheet" type="text/css" href="<%= (session.getAttribute("LoginUser") != null ?
                             ((com.srit.hrnet.emp.EmployeeGenTO)session.getAttribute("LoginUser")).getEmpPageStyleSheet() :
                             com.srit.hrnet.components.access.AccessCodes.GLOBAL_STYLESHEET)%>">
    <script language="javaScript" src="<%= request.getContextPath()%>/jscript/GlobalValidationScript.js" purpose="include"></script>
    <%      
    int dateFormat = (session.getAttribute("LoginUser") != null ? ((com.srit.hrnet.emp.EmployeeGenTO)session.getAttribute("LoginUser")).getDateFormat() : 2);
         System.out.println("/reports/training/TRngBaseReport dateFormat = "+dateFormat);
         /* *** get the current date *** */
         java.util.GregorianCalendar gc1 = new java.util.GregorianCalendar();
         int yy = gc1.get(java.util.Calendar.YEAR);
         int mm = gc1.get(java.util.Calendar.MONTH);
         int dd = gc1.get(java.util.Calendar.DATE);     
         mm = mm + 1;
         String mon;
         String day;
         if(dd <= 9)
              day = "0" + java.lang.String.valueOf(dd);
         else
              day = java.lang.String.valueOf(dd);
         if(mm <= 9)
              mon = "0" + java.lang.String.valueOf(mm);
         else
              mon = java.lang.String.valueOf(mm);
         java.lang.String currentDate = "";
         if(dateFormat == 3){
              currentDate = java.lang.String.valueOf(yy+"/"+mon+"/"+day);/* (yyy-mm-dd format) */
         }else if(dateFormat == 1){
              currentDate = java.lang.String.valueOf(mon+"/"+day+"/"+yy);/* (mm-dd-yyy format) */
         }else if(dateFormat == 2){
              currentDate = java.lang.String.valueOf(day+"/"+mon+"/"+yy);/* (dd-mm-yyy format) */
         System.out.println("/reports/training/TRngBaseReport currentDate = "+currentDate);
    %>
    <script language="javaScript" src="<%= (session.getAttribute("LoginUser")!=null ? ((com.srit.hrnet.emp.EmployeeGenTO)session.getAttribute("LoginUser")).getScriptFile() : "")%>" purpose="include"></script>
    <script language="javaScript" src="jscript/CommonDialog.js" purpose="include"></script>
    <script language="javaScript" src="jscript/GlobalValidationScript.js"></script>
    <script language="javascript">
         var gNow = new Date("<%=currentDate%>");
         function val_complaint()
    if(document.GreivanceForm.complaintName.value.length==0)
         alert("Enter Complaint Name");
         document.GreivanceForm.complaintName.focus();
         return false;
    if(document.GreivanceForm.category.value =='NA')
         alert("select category");
         document.GreivanceForm.category.focus();
         return false;
    if(document.GreivanceForm.priority.value == 'NA')
         alert("select priority");
         document.GreivanceForm.priority.focus();
         return false;
         if(document.GreivanceForm.occdate.value == "")
              alert("Enter Date (dd/mm/yy)");
              document.GreivanceForm.occdate.focus();
              return false;
         else     
         if(document.GreivanceForm.occdate.value>document.GreivanceForm.currentDate.value){
                   alert("select Previous or Current date");
                   document.GreivanceForm.occdate.focus();
                   return false;
         if(document.GreivanceForm.occtime.value == "")
         alert("Select Time of Occurence.");
         document.GreivanceForm.occtime.focus();
         return false;
    else
    if(!IsValidTime(document.GreivanceForm.occtime.value) )
    alert("Enter Valid Time (HH:MM)");
              return false;
         if(document.GreivanceForm.desc.value == "")
         alert("Enter Description");
         document.GreivanceForm.desc.focus();
         return false;
              document.forms[0].compOption.value='submitForm';
              document.forms[0].submit();
              return false;
         function IsValidTime(givenTime)
              var hour = 0;
              var minute = 0;
              var timePat = /^(\d{1,2}):(\d{1,2})?$/;
              var matchArray = givenTime.match(timePat);
              if (matchArray == null)
                   alert("Enter Valid Time.");
                   return false;
              hour = matchArray[1];
              minute = matchArray[2];
              if(hour==0 && minute==0)
              alert("The Time You Entered is 0:0");
              return false;
              if (hour < 0 || hour > 23)
              alert("Hour must be between 0 and 23");
              return false;
              if (minute<0 || minute > 59)
              alert ("Minute must be between 0 and 59.");
              return false;
              return true;
    unction help(url)
         var attributes = 'menubar=no,toolbar=no,location=no,width=625,height=375,resizable=yes';
         var name = 'Help';
         window.open(url,name,attributes);
    //return false;
    </script>
    <script language = "javaScript" src = "<%=request.getContextPath()%>/jscript/CommonDialog.js" purpose = "include"></script>
    </HEAD>
    <body bgcolor="#FFFFFF" onload="setFocus()">
    <GenerateTab:displaytabs tabId="<%=com.srit.hrnet.masters.gui.GUIConstants.HD_GRIEVANCE_REDRESSAL_FORM%>" activeSubTab="0" >
    <table align="right">
              <tr>
                   <td>
                        <img src="<%=request.getContextPath()%>/images/help.gif" border="0" alt="Help">
                   </td>     
              </tr>     
         </table>
         <html:form action="/helpdesk/GrievanceComplaint" enctype="multipart/form-data" method="POST" onsubmit="javascript:return val_complaint()">
         <html:hidden property="compOption" value="submitForm" />
         <html:hidden property="onbehalf"/>
         <html:hidden property="employeeId"/>
         <html:hidden property="hidSelectedNames"/>
         <html:hidden property="selectedrequestor"/>
         <html:hidden property="individual"/>
         <table cellpadding="3" cellspacing="0" align="center" >
              <th align="center" class="tablehead" colspan="2">
              <b> Complaint Form </b>
              </th>
    <tr>
                   <td colspan="1" class='tablesubhead'>
                   <b><bean:message key="com.srit.hrnet.helpdesk.redressal.form.complaintname"/></b><font class="star"> *</font>
                   </td>
                   <td class='subhead'>
                   <html:text property="complaintName" maxlength="99"/>
                   </td>
              </tr>
         <tr>
                   <td class='tablesubhead' colspan="1"><b><bean:message key="com.srit.hrnet.helpdesk.redressal.form.category"/></b>
                   <font class="star">*</font></td>
                        <td class="tableright" property="category" >
                        <iterateTag:iterate propertyName='<%=IterateInterface.ITERATE_HELPDESK_GRIEVANCE_CATEGORY%>' defaultSelected='<%=request.getAttribute("category")==null?null:""+request.getAttribute("category")%>' selectSize='<%=100%>' tabInd='<%="3"%>'>
                        </iterateTag:iterate>
                   </td>
              </tr>
              <tr>
                   <td class='tablesubhead' colspan="1"><b><bean:message key="com.srit.hrnet.helpdesk.redressal.form.priority"/></b>
                   <font class="star">*</font></td>
                   <td class="subhead">
                        <iterateTag:iterate propertyName='<%=IterateInterface.ITERATE_HELPDESK_GRIEVANCE_PRIORITY%>' defaultSelected='<%=request.getAttribute("priority")==null?null:""+request.getAttribute("priority")%>' selectSize='<%=100%>' tabInd='<%="3"%>'>
                                  </iterateTag:iterate>
                   </td>
         </tr>
         <tr>
                             <td class='tablesubhead' colspan=1><b>Date of Occurence</b>
                             <font class="star">*</font> </td>
                             <td class="subhead">     
                             <html:text name="GreivanceForm" property="occdate" maxlength="10"/>
                             <input type="hidden" name="currDate" />
                             <img src="<%= request.getContextPath()%>/images/calendar.jpg" border="0" alt="Calendar" >
                             </td>                         
                   </tr>
                                  <tr>
                                       <td class='tablesubhead' colspan=1><b>Time of Occurence</b>
                                       <font class="star">*</font></td>
                                       <td class="subhead">     
                                       <html:text name="GreivanceForm" property="occtime" maxlength="10"/> (24 Hrs format)</td>
                             </tr>
                             <tr>
                        <td class="tablesubhead" colspan=1>
                             <b>Description</b>
                             <font class="star">*</font></td>
                                       <td class="subhead">
                                       <html:textarea property="desc" styleClass="formObject" cols="40" rows="4"></html:textarea>
                                       </td>
                        </tr>
                   <tr>
              <td class="tablesubhead" colspan=1>
                   <b>Comments/Suggestions</b>
              </td>
                             <td class="subhead">
                             <html:textarea property="comments" styleClass="formObject" value="" cols="40" rows="4"></html:textarea>
                             </td>
                   </tr>
                   <tr>
                   <td class="tableleft">
              <b><bean:message key="com.srit.hrnet.helpdesk.redressal.form.attachment"/> </b>
                                  </td>
                             <td class="tableright">
                                  <html:file property="file" size="18" />
                             </td>
              </tr>
                   <tr>
                   <td colspan="2" align="center" class="tablesubhead">
                   <input type="submit" class="submit" value="Submit" >
                    <html:reset property="reset" styleClass="submit" />
                   </td>
              </tr>
    </table>
         <input type="hidden" name="currentDate" value="<%=currentDate%>">
    </html:form>
    </GenerateTab:displaytabs>
    <html:javascript formName="/SubmitComplaint"/>
    </body>
    </html:html>
    please help me..

    VAS_MS wrote:
    please help me..First help yourself by posting a clear question
    You have far to much code posted and without the use of the correct code tags its almost unreadable.
    You have a question about uplaoding files with Struts then get rid of all the junk in your code thats not related to uploading files.
    If you have an error then post the relevant information on the error
    like
    org.apache.commons.beanutils.ConversionException:
    Cannot assign value of type 'org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile' to property 'file' of type 'java.lang.String'
    org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:424)If you had posted only that you would have given enough information, that error says it all you are trying to put your file into a String and its not working.
    reread the tutorial/documentation provided and try again
    Edited by: pgeuens on 21-mrt-2008 8:04

  • Not creating bean while submitting form...

    i am using struts for displaying and updating data in jsp. my form bean is as follows:
    public class AppraisalDataForm extends ActionForm {
         private String name;
         private String appraisalId;
         private String empId;
         private String appraisalFromDate;
         private ArrayList<AppraisalHeadDt> appraisalHeadDts;
         private ArrayList<AppraisalPerformanceDt> appraisalPerformanceDts; 
                    // getters and settersAppraisalHeadDt.java is as follows:
    public class AppraisalHeadDt  implements Serializable {
         private AppraisalHeadDtPK compId;
         private String accessMode;
         private String appraiserComments;
         private String appraiserId;
         private Integer appraiserRating;
                    // getter and settersAppraisalHeadDtPK.java is as follows:
    public class AppraisalHeadDtPK implements Serializable {
         private String appraisalId;
         private String empId;
         private String headType;
                       // getters and settersmy Jsp is as follows:
    <logic:iterate id="appraisalHeadDt" indexId="index" name="AppraisalDataForm" property="appraisalHeadDts" type="com.yash.services.appraisal.hbeans.AppraisalHeadDt">
                                                <nested:define id="compId" name="appraisalHeadDt" property="compId" type="com.yash.services.appraisal.hbeans.AppraisalHeadDtPK"/>
                                                 <html:hidden name="appraisalHeadDt" property="compId.appraisalId" indexed="true"/>
                                                 <html:hidden name="appraisalHeadDt" property="compId.empId" indexed="true"/>
                                                 <tr>
                                                      <td align="center">
                                                           <html:select name="appraisalHeadDt" property="compId.headType" indexed="true">
                                                                <nested:options collection="HeaderTypes" labelProperty="value" property="key"/>
                                                           </html:select>
                                                      </td>
                                                      <td align="center">
                                                           <html:select name="appraisalHeadDt" property="waitage" indexed="true" >
                                                                <nested:options collection="Ratings" labelProperty="value" property="key"/>
                                                           </html:select>
                                                      </td>
                                                      <td align="center">
                                                           <html:select name="appraisalHeadDt" property="difficultyLevel" indexed="true" >
                                                                <nested:options collection="Ratings" labelProperty="value" property="key"/>
                                                           </html:select>
                                                      </td>                                            .
                                                                        .i want to display it on jsp and user can modify that data which need to submit in action class.
    now i m able to display data properly but at time of submiting data it throws exception :
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
    java.lang.IllegalArgumentException: No bean specified
         org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937)

    Indexed forms are always difficult. And you've got a double nested item there.
    Can you pinpoint a bit better exactly which of the fields here is creating a problem?
    My instinct would be the one with the doubly nested bean - referring to the compId.headType"
    If you remove that control, do the other bits work correctly?
    You might try switching on some logging for the BeanUtils to see exactly which property it is trying to set on which bean and see the logging can give you more insight into what is happening.
    I would also suggest starting with a simpler example that works, and then building back up to this one.
    Hope this helps,
    evnafets

  • Problem with FileUpload with Struts

    Hello,
    Here is my form I've created :
    <html:form action="/UploadFile.do" method="post" enctype="multipart/form-data">
    <html:file property="file" />
    </html:form>
    The form I submit conatins a "file" attribute of FileForm type.
    I did exatcly as mentionned in different tutorials to upload files with Struts.
    But I get the following exception and I can't figure out what's happening:
    javax.servlet.ServletException: BeanUtils.populate
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
    java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    Please Help !
    I'm using Struts 1.1 by the way
    Thank your for your help
    Hugo

    What is in the form bean you're using? You need a field that holds a FormFile object:
    import org.apache.struts.upload.*;
         private FormFile file;
         public FormFile getFile() {
              return this.file;
         public void setFile(FormFile file) {
              this.file = file;
    ...

  • Ava.lang.IllegalArgumentException: No bean specified

    config
    <form-beans>
    <form-bean name="FileUpload" type="roseindia.net.StrutsUploadForm"/>
    </form-beans>
    <action-mappings>
         <action path="/FileUpload" type="roseindia.net.StrutsUploadAction" name="FileUpload" scope="session" validate="true" input="/pages/FileUpload.jsp">
    <forward name="success" path="/pages/uploadsuccess.jsp"/>
         </action>
         <action path="/popsup" type="roseindia.net.StrutsUploadAction" name="FileUpload" scope="session" validate="true" parameter="parameter" input="/pages/uploadsuccess.jsp">
    <forward name="success" path="/pages/uploadsuccess.jsp"/>
         </action>
    </action-mappings>
    my first jsp is <B>FileUpload.jsp<B> like this
    <html:form action="/FileUpload" method="post" enctype="multipart/form-data">
    <html:file property="theFile"/>
    <html:submit>Upload File</html:submit>
    </html:form>
    after clicking the Upload file button, the <B>uploadSuccess.jsp<B> looks like this
    <html:form action="/popsup?parameter="show" method="post">
    <html:select property="valueObj.id">
         <html:optionsCollection property="objectList" value="id" label="fullName" name="FileUpload"/>
    </html:select>
    <html:submit/>
    </html:form>
    The correspondin form beans are
    public class StrutsUploadForm extends ActionForm
    { //assume all the methods are publlic
    FormFile theFile;
    ArrayList objectList;
    valueObject valueObj;
    FormFile getTheFile() {
    return theFile;
    void setTheFile(FormFile theFile) {
    this.theFile = theFile;
    void setValueObj(valueObject valueObj){
         this.valueObj = valueObj;          
    valueObject getValueObj(){
         return this.valueObj;
    void setObjectList(ArrayList objectList){
         this.objectList = objectList;
    ArrayList getObjectList(){
         return this.objectList;
    my value Object is
    public class valueObject
    String id;
    String firstName;
    String lastName;
    String fullName;
    valueObject(String id,String firstName,String lastName){
         this.id = id;
         this.firstName = firstName;
         this.lastName = lastName;
    void setId(String id){
         this.id=id;
    String getId(){
         return this.id;
    void setFirstName(String firstName){
         this.firstName = firstName;
    String getFirstName(){
         return firstName;
    void setLastName(String lastName){
         this.lastName = lastName;
    String getLastName(){
         return lastName;
    getFullName(){
         return firstName+lastName;
    and my action class is
    public class StrutsUploadAction extends Action
    public ActionForward execute(..){
    StrutsUploadForm myForm = (StrutsUploadForm)form;
    if(!"show".equals(request.getParameter("parameter"))){
    valueObject v1 = new valueObject("3","Babu","Prasad");
         myForm.setValueObj(v1);
         ArrayList valueList = new ArrayList();
         valueList.add(new valueObject("1","vijay","ks"));
         valueList.add(new valueObject("2","Ram","Kumar"));
         valueList.add(v1);
         valueList.add(new valueObject("4","Raju","sundaram"));
         valueList.add(new valueObject("5","Kamal","Batch"));
         valueList.add(new valueObject("6","Ragu","varan"));
         myForm.setObjectList(valueList);
    }else{
         System.out.println("myFORM OBJECTS "+myForm.getValueObj().getId());
    return mapping.findForward("success");
    But i try to select one of the value form the combo box and submit the uploadsuccess.jsp ,i am getting the following error
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    root cause
    java.lang.IllegalArgumentException: No bean specified
         org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

    Could you give us the code of your JSP where you think things might go wrong ?

  • Error while hosting in tomcat

    hi
    Could anyone please help me to solve this stuff.....
    My application id working fine in my loal machine tomcat.... but after hostin it to tomcat server in www, i get the below exception.....
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    root cause
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
         java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         java.security.AccessController.checkPermission(AccessController.java:427)
         java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
         java.lang.Class.checkMemberAccess(Class.java:2125)
         java.lang.Class.getDeclaredMethods(Class.java:1762)
         org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
         org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
         org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
         org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
         org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:907)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
    Apache Tomcat/5.0.27

    Divilin wrote:
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.And?

  • Plz anyone help me..its urgent..

    Hi all
    am doing project with struts, j2ee, jsp ete..
    and am getting client side exception like
    javax.servlet.ServletException: BeanUtils.populate
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    so anyone can plz help me out of this..
    am expecting u r reply
    Thanks in advance !!!

    Is there nothing more to the exception?
    This exception was caused by.....?
    Look for the root cause in the exception and try posting that.
    The error is in the BeanUtils populate method, which takes request parameters and puts them into your form bean.
    What form bean are you using? Your own class, or a form defined in the struts-config.xml?
    Show the struts-config related to the request you are making.

  • Servlet not compiling

    These are my 3 files
    package coreservlets.beans;
    class InsuranceInfo
         private String name = "No name specified";
         private String employeeID = "No ID specified";
         private int numChildren = 0;
         private boolean isMarried = false;
         public String getName()
              return(name);
         public void setName(String name)
              this.name = name;
         public String getEmployeeID()
              return(employeeID);
         public void setEmployeeID(String employeeID)
              this.employeeID = employeeID;
         public void setNumChildren(int numChildren)
              this.numChildren = numChildren;
         public int getNumChildren()
              return(numChildren);
         public boolean isMarried()
              return(isMarried);
         public void setMarried(boolean isMarried)
              this.isMarried = isMarried;
    package coreservlets.beans;
    import java.util.*;
    import javax.servlet.http.*;
    import org.apache.commons.beanutils.*;
    public class BeanUtilities
        public static void populateBean(Object formBean, HttpServletRequest request)
         populateBean(formBean, request.getParameterMap());
        public static void populateBean(Object bean, Map propertyMap)
         try
             BeanUtils.populate(bean, propertyMap);
         catch(Exception e)
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.commons.beanutils.*;
    import coreservlets.beans.*;
    public class SubmitInsuranceInfo extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              InsuranceInfo info = new InsuranceInfo();
              BeanUtilities.populateBean(info,request);
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C HTML 4.0 " + "Transitional//EN\">\n";
              String title = "Insurance Info For " + info.getName();
              out.println(docType  + "<html>" + "<head><title>" + title + "</title></head>");
              out.println("<center><h1>" + title + "</h1><br>");
              out.println("<ul><li>Employee ID: " + info.getEmployeeID() + "<br><li>Number Of Children: " + info.getNumChildren());
              out.println("<li><br>Married: " + info.isMarried() + "</ul></center></body></html>");
    }i compile the file InsuranceInfo and BeanUtilities. Both compiled.I put both the classfiles inside coreservlets/beans.
    Now I tried to compile SubmitInsuranceInfo where I have import coreservlets.beans.;
    linux-9jc3:~/Development/Servlets # javac SubmitInsuranceInfo.java
    SubmitInsuranceInfo.java:11: cannot access InsuranceInfo
    bad class file: ./InsuranceInfo.java
    file does not contain class InsuranceInfo
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    InsuranceInfo info = new InsuranceInfo();
    ^
    1 error
    I can't understand the error because I have set the classpath to .
    I am compiling from a folder called Servlet
    The directory structure is
    Servlet
    |____SubmitInsuranceInfo.java
    |____coreservlet
    |
    |____beans
    |
    |____InsuranceInfo.class
    |____BeanUtilities.class

    Did that but still I am getting the same error
    SubmitInsuranceInfo.java:11: cannot access InsuranceInfo
    bad class file: ./InsuranceInfo.java
    file does not contain class InsuranceInfo
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    InsuranceInfo info = new InsuranceInfo();
    ^
    1 error
    linux-9jc3:~/Development/Servlets #
    It looks like a classpath issue
    I have the classpath as . and moreover I have put both the InsuranceInfo and BeanUtilities.class in coreservlets/beans/ folder. The coreservlets dir is in Servlets dir. I am compililing the SubmitInsuranceInfo.java file from the Servlets dir.

  • Multiple form upload

    Hi everybody.
    I'm trying to use a form to upload several files, all at once.
    I use Struts and Commons facilities (that is the FormFile interface).
    Here's my action form:
    public class AttachmentForm
    extends ActionForm {
    /* Files to upload */
    private FormFile[] uploadedFiles;
    public FormFile[] getUploadedFiles() {
    return uploadedFiles;
    public void setUploadedFiles(FormFile[] uploadedFiles) {
    this.uploadedFiles = uploadedFiles;
    And this is the html code I use to populate the action form (I'm using Velocity, but I don't think this is really important):
    <html>
    <body>
    <form name="uploadForm" method="post" enctype="multipart/form-data" action="(...my action...)">
    Attachment 1: <input type="file" name="uploadedFiles"/>
    Attachment 2: <input type="file" name="uploadedFiles"/>
    Attachment 3: <input type="file" name="uploadedFiles"/>
    </form>
    </body>
    </html>
    Everytime I submit the form I obtain this exception:
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)     
    java.lang.IllegalArgumentException: argument type mismatch
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
         org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
         org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    If I adjust the java source to manage one file only (ie. FileForm instead of FileForm[]) it works, but as I try to use an array I get the Exception.
    I use struts 1.1 on Windows XP platform and Tomcat 5.0.24.
    Have you got any ideas? Is it a bug of commons-beanutils?
    Thanks in advance,
    Paul

    Hi!
    Thks for your reply.
    If I define mutiple file inputs :
    <input type="file" name="uploadFile" ...
    <input type="file" name="uploadFile" ...
    and define a variable on the Struts form like;
         private FormFile[] uploadFile = null;
    Struts throws the exception below while trying to fill the array.
    I can fill arrays of Strings, ints,....but with the FormFile I am having this Exception. I would prefer to use Struts mechanism to upload files instead of doing things "manually". Any help would be appreciated.
    Thanks in advance,
    Victor Batista
    13:07:38,603 ERROR [Engine] StandardWrapperValve[struts]: Servlet.service() for
    servlet struts threw exception
    java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
    Utils.java:1789)
    at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
    Utils.java:1684)
    at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
    java:1713)
    at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:101
    9)
    at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
    essor.java:798)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:205)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
    4)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at pt.ptinovacao.dino.admin.servlet.filter.StrutsFilter.doFilter(StrutsF
    ilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at pt.ptinovacao.dino.admin.servlet.filter.DefaultFilter.doFilter(Defaul
    tFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
    lter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
    ContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
    ipalValve.java:66)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
    yAssociationValve.java:150)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:462)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
    e.java:54)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    535)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
    0)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:683)
    at java.lang.Thread.run(Thread.java:534)

  • ActionForm with Dynamic Fields/#Fields

    I'm new to struts (and JSP for that matter) and I'm having some difficulty setting up particular actionForm and actionForward.
    What I want to do is based off a value selected from a drop down present the user with different sets of "volumes" to enter.
    I'm placing a collection of volumeBeans in my actionForm as a bean property.
    like so
         private ArrayList volumeList;
         * Indexed getter for property volume.
         * @param index Index of the property.
         * @return Value of the property at <CODE>index</CODE>.
        public Collection getVolumeList() {         
            return volumeList;
        public void setVolumeList(Collection list){
            volumeList = (ArrayList)list;
        public volumeBean getVolume(int index){
         return (volumeBean)volumeList.get(index);   
        public void setVolume(int index,volumeBean vol){
            volumeList.set(index, vol);
    ...I iterate through the collection using a struts iterate tag
    like so
         <logic:iterate id="vol" name="sprDataForm" property="volumeList" indexId="ctr" >
         <tr>
             <%-- Writing out vol.volumeName --%>
             <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].volumeName"%>'/></td>
             <%-- want to get/store volumeQuantity in sprDataForm.volume[index].quantity --%>
             <td><html:text name="sprDataForm" property='<%="volume["+ ctr + "].quantity"%>'/></td>
             <%-- --%>
             <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].unitOfMeasure"%>'/></td>
         </tr>         
        </logic:iterate>
    ...Now this works fine if I hardcode the values of the volumeList into the actionForm constructor but what I want to be able to do is set the volumeList inside of an LookupDispatchAction actionForward in such a manner that when the page loads the first time the volumeList is empty but after triggering a specific action forward the list gets populated on other values in the form.
    like so
    public ActionForward pre(ActionMapping mapping,
                ActionForm form,
                HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException {
            ArrayList volumeList = new ArrayList(3);
            volumeBean a = new volumeBean("Volume A", "vol_ID_a", "tDesc", "Number of Boxes ");
            volumeBean b = new volumeBean("Volume b", "vol_ID_b", "tDesc", "Number of Envelopes");
            volumeList.add(a);
            volumeList.add(b);
            volumeList.trimToSize();    
            SprDataForm sprDataForm = (SprDataForm)form;
            sprDataForm.setVolumeList(volumeList);
            // finds the action mapped to sucess and forwards to that page
            return(mapping.findForward("loopback"));
    ...currently i've mapped the action to one of my buttons (I will change this later ). The volumeList does populate and the page does reload with the correct fields/values
    displayed but when I try to submit the page again (with an empty ActionForward) I get the following error
    java.lang.IllegalArgumentException: No bean specified
         org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    I'm wondering If i'm just missing somethign obvious or If my approach is fundamentally flawed

    I'm new to struts (and JSP for that matter) and I'm having some difficulty setting up particular actionForm and actionForward.
    What I want to do is based off a value selected from a drop down present the user with different sets of "volumes" to enter.
    I'm placing a collection of volumeBeans in my actionForm as a bean property.
    like so
         private ArrayList volumeList;
         * Indexed getter for property volume.
         * @param index Index of the property.
         * @return Value of the property at <CODE>index</CODE>.
        public Collection getVolumeList() {         
            return volumeList;
        public void setVolumeList(Collection list){
            volumeList = (ArrayList)list;
        public volumeBean getVolume(int index){
         return (volumeBean)volumeList.get(index);   
        public void setVolume(int index,volumeBean vol){
            volumeList.set(index, vol);
    ...I iterate through the collection using a struts iterate tag
    like so
         <logic:iterate id="vol" name="sprDataForm" property="volumeList" indexId="ctr" >
         <tr>
             <%-- Writing out vol.volumeName --%>
             <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].volumeName"%>'/></td>
             <%-- want to get/store volumeQuantity in sprDataForm.volume[index].quantity --%>
             <td><html:text name="sprDataForm" property='<%="volume["+ ctr + "].quantity"%>'/></td>
             <%-- --%>
             <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].unitOfMeasure"%>'/></td>
         </tr>         
        </logic:iterate>
    ...Now this works fine if I hardcode the values of the volumeList into the actionForm constructor but what I want to be able to do is set the volumeList inside of an LookupDispatchAction actionForward in such a manner that when the page loads the first time the volumeList is empty but after triggering a specific action forward the list gets populated on other values in the form.
    like so
    public ActionForward pre(ActionMapping mapping,
                ActionForm form,
                HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException {
            ArrayList volumeList = new ArrayList(3);
            volumeBean a = new volumeBean("Volume A", "vol_ID_a", "tDesc", "Number of Boxes ");
            volumeBean b = new volumeBean("Volume b", "vol_ID_b", "tDesc", "Number of Envelopes");
            volumeList.add(a);
            volumeList.add(b);
            volumeList.trimToSize();    
            SprDataForm sprDataForm = (SprDataForm)form;
            sprDataForm.setVolumeList(volumeList);
            // finds the action mapped to sucess and forwards to that page
            return(mapping.findForward("loopback"));
    ...currently i've mapped the action to one of my buttons (I will change this later ). The volumeList does populate and the page does reload with the correct fields/values
    displayed but when I try to submit the page again (with an empty ActionForward) I get the following error
    java.lang.IllegalArgumentException: No bean specified
         org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    I'm wondering If i'm just missing somethign obvious or If my approach is fundamentally flawed

Maybe you are looking for

  • Delete empty space in PLD footer

    Hello, In my report done with PLD I have the following need: For example the footer contains 3 fields : If the 3 fields contains data, it's displayed like this: Total A Total B Total C If the field Total B doesn't contain any data, it's displayed lik

  • Clearings of open items in FB05

    Hi, I am using the function module posting_interface_clearing to post & clear the open items. Here the requirement is we need to clear the open items from two different customer accounts against a single bank account. For example the amount of 1000 E

  • Looking for a way to search artists in Apple TV from iTunes Match?

    Looking for a way to search artists in Apple TV from iTunes Match similar to searching for a movie in Netflix.  

  • Webi Reports error on refresh - source - SAP BW

    Hi, We recently upgraded out SAP BW to SP7. Since then, all our webi reports have been giving the following error when we try to refresh the reports: "A database error occured. The database error text is: A pointer intended for use is NULL. m_pComman

  • Opening a file inside my webapp

    Hi all I want to this method XSLTransformer.doTransform(xml,new File("/templates/default/webpage.xsl"),new StreamResult(out)); opens the file webpage.xsl for a XSL processing. The file is in: Web Pages -> templates/default/webpage.xsl (nb5) but i can