Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.ClassCastException

Status
Not open for further replies.

maxpower1

Programmer
Jul 29, 2001
488
US
I'm getting this error everytime I try to run my jsp page.

when I have this attribute in my jsp page:-


<html:form action=&quot;/ViewOperation&quot;
type=&quot;myCom.struts.operation.OperationAction&quot;>

It loads ok. but when i added the line

name=&quot;operationForm&quot;

I get java.lang.ClassCastException. any clues?

thanks

~za~
You can't bring back a dead thread!
 

(guessing) ...
... this is because when Struts renders the JSP, it assigns its own name - in this case it would be &quot;ViewOperationForm&quot; - and (I think) this name is used to lookup the class for the form bean - is there another form bean named &quot;operationForm&quot; ?
 
thanks sedj for replying. I tried changing the form name from operationsForm to operationsSearchForm:-

<form-bean name=&quot;operationsSearchForm&quot;
type=&quot;mycom.struts.operations.OperationsForm&quot;/>

in the action-mapping, I thus did this:-

<action path=&quot;/ViewOperations&quot;
type=&quot;mycom.struts.operations.OperationsAction&quot;
validate=&quot;false&quot;
input=&quot;/viewoperations.jsp&quot;
name=&quot;operationsSearchForm&quot;>
<set-property property=&quot;debugEnabled&quot; value=&quot;true&quot;/>
<set-property property=&quot;loginRequired&quot; value=&quot;true&quot;/>
<forward name=&quot;success&quot; path=&quot;/viewoperations.jsp&quot;/>
<forward name=&quot;error&quot; path=&quot;/viewoperations.jsp&quot;/>
</action>

I still get the same error. any other ideaas?

thanks!

~za~
You can't bring back a dead thread!
 
>is there another form bean named &quot;operationForm&quot; ?
there is only one operationForm(I renamed it to operationsForm.

~za~
You can't bring back a dead thread!
 
never mind. fixed it. I created a new action-mapping called
GetOperations and map it to the ActionForm. Still, I don't think the &quot;View&quot; keyword has anything to do with it.

My Struts knowledge is getting rusty now. I think i better reread mr. goodwill's book again.



~za~
You can't bring back a dead thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top