Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

java . lang . IllegalArgumentException: No bean specified

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 FileUpload.jsp 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 uploadSuccess.jsp looks like this

<html:form action="/popsup?parameter="show" method="post">
<html:select property="valueObj.id">
<html ptionsCollection 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)
 
Onion rings are vegetable donuts. Taste this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic