Please post questions about using Struts to the Struts Users list only. The Struts Dev list is for discussing the development and enhancement of Struts itself.

http://struts.apache.org/mail.html

L.

Vijay KS wrote:
onfig
<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: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)


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

Reply via email to