You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ortega, Carlos" <co...@water.ca.gov> on 2002/10/17 05:32:17 UTC

WHY! Won't Form Classes Load

It's four hours after I promissed my wife I'd be home and I'm sitting in the office scratching my head, wondering WHY struts won't load ActionForm classes.

In a previous thread I mentioned that when I deploy a working beta 1 Struts application on iPlanet 6.0 and attempt to load a JSP that references any ActionForm I get the following silly error:

javax.servlet.ServletException: Exception creating bean of class [YourActionFormClassHere!]

The form bean is found, but cannot be loaded?!? It get's even more interesting. I discovered that if I bypassed the JSP page and called the ".do" instead, in this case "logon.do", the form would actually load. The page had validation errors, as if the user had attempted to login without entering their user name and password.

After mentioning this on a previous thread Greg wisely mentioned using the controller to front all of my JSPs. In other words, create an action class that I would call to access the JSPs. So I created a class named RelayAction, designed to accept a "forward" name as an argument. Unfortuneatly, using it resulted in the same error. Here's where the head scratching begins. Why was the form able to load when I called the "Logon.do" and fail when I used RelayAction?

Long story short (and I may be too late), I discovered a key difference between the LogonAction and the RelayAction is how they are defined in struts-config.xml. Take a look at the two definitions:

LogonAction
-------------------------------
<action
   path="/logon"
   name="logonForm"
   type="app.forms.LogonAction"
   scope="request"
   input="/logon.jsp">
</action>

RelayAction
-------------------------------
<action
   path="/relay"
   type="app.forms.RelayAction">
</action>

I now know that calling "Logon.do" was able to load the form because when LogonAction fails, it forwards control to the "input" page, which is set to "/logon.jsp" above. The LogonAction code that does this is below:

if (!errors.empty()) {
   saveErrors(request, errors);
   return (new ActionForward(mapping.getInput()));
}

I don't understand why LogonAction class is able to load LogonForm using mapping.getInput() and the RelayAction cannot using mapping.findForward? They both return ActionForward. Can it be because there is a difference between mapping.getInput() and mapping.findForward()!?

If you've got pointers, please point-on. I need help here.

(going home now...)

Carlos Ortega


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WHY! Won't Form Classes Load

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
Excuse the mix up, ignore this, wrong tread, etc.

V. Cekvenich wrote:
> You can have the V (Swing) talk to M (Beans) via Soap/Axis easy and have 
> re-use. This I do often.
> If you used your controller via interfaces, you can call the business 
> logic from SOAP as well. This I designed.... but have yet to test in a 
> real world. (Remember question as to why I have interface on action?)
> 
> .V
> 
> Ortega, Carlos wrote:
> 
>> It's four hours after I promissed my wife I'd be home and I'm sitting 
>> in the office scratching my head, wondering WHY struts won't load 
>> ActionForm classes.
>>
>> In a previous thread I mentioned that when I deploy a working beta 1 
>> Struts application on iPlanet 6.0 and attempt to load a JSP that 
>> references any ActionForm I get the following silly error:
>>
>> javax.servlet.ServletException: Exception creating bean of class 
>> [YourActionFormClassHere!]
>>
>> The form bean is found, but cannot be loaded?!? It get's even more 
>> interesting. I discovered that if I bypassed the JSP page and called 
>> the ".do" instead, in this case "logon.do", the form would actually 
>> load. The page had validation errors, as if the user had attempted to 
>> login without entering their user name and password.
>>
>> After mentioning this on a previous thread Greg wisely mentioned using 
>> the controller to front all of my JSPs. In other words, create an 
>> action class that I would call to access the JSPs. So I created a 
>> class named RelayAction, designed to accept a "forward" name as an 
>> argument. Unfortuneatly, using it resulted in the same error. Here's 
>> where the head scratching begins. Why was the form able to load when I 
>> called the "Logon.do" and fail when I used RelayAction?
>>
>> Long story short (and I may be too late), I discovered a key 
>> difference between the LogonAction and the RelayAction is how they are 
>> defined in struts-config.xml. Take a look at the two definitions:
>>
>> LogonAction
>> -------------------------------
>> <action
>>    path="/logon"
>>    name="logonForm"
>>    type="app.forms.LogonAction"
>>    scope="request"
>>    input="/logon.jsp">
>> </action>
>>
>> RelayAction
>> -------------------------------
>> <action
>>    path="/relay"
>>    type="app.forms.RelayAction">
>> </action>
>>
>> I now know that calling "Logon.do" was able to load the form because 
>> when LogonAction fails, it forwards control to the "input" page, which 
>> is set to "/logon.jsp" above. The LogonAction code that does this is 
>> below:
>>
>> if (!errors.empty()) {
>>    saveErrors(request, errors);
>>    return (new ActionForward(mapping.getInput()));
>> }
>>
>> I don't understand why LogonAction class is able to load LogonForm 
>> using mapping.getInput() and the RelayAction cannot using 
>> mapping.findForward? They both return ActionForward. Can it be because 
>> there is a difference between mapping.getInput() and 
>> mapping.findForward()!?
>>
>> If you've got pointers, please point-on. I need help here.
>>
>> (going home now...)
>>
>> Carlos Ortega
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WHY! Won't Form Classes Load

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
You can have the V (Swing) talk to M (Beans) via Soap/Axis easy and have 
re-use. This I do often.
If you used your controller via interfaces, you can call the business 
logic from SOAP as well. This I designed.... but have yet to test in a 
real world. (Remember question as to why I have interface on action?)

.V

Ortega, Carlos wrote:
> It's four hours after I promissed my wife I'd be home and I'm sitting in the office scratching my head, wondering WHY struts won't load ActionForm classes.
> 
> In a previous thread I mentioned that when I deploy a working beta 1 Struts application on iPlanet 6.0 and attempt to load a JSP that references any ActionForm I get the following silly error:
> 
> javax.servlet.ServletException: Exception creating bean of class [YourActionFormClassHere!]
> 
> The form bean is found, but cannot be loaded?!? It get's even more interesting. I discovered that if I bypassed the JSP page and called the ".do" instead, in this case "logon.do", the form would actually load. The page had validation errors, as if the user had attempted to login without entering their user name and password.
> 
> After mentioning this on a previous thread Greg wisely mentioned using the controller to front all of my JSPs. In other words, create an action class that I would call to access the JSPs. So I created a class named RelayAction, designed to accept a "forward" name as an argument. Unfortuneatly, using it resulted in the same error. Here's where the head scratching begins. Why was the form able to load when I called the "Logon.do" and fail when I used RelayAction?
> 
> Long story short (and I may be too late), I discovered a key difference between the LogonAction and the RelayAction is how they are defined in struts-config.xml. Take a look at the two definitions:
> 
> LogonAction
> -------------------------------
> <action
>    path="/logon"
>    name="logonForm"
>    type="app.forms.LogonAction"
>    scope="request"
>    input="/logon.jsp">
> </action>
> 
> RelayAction
> -------------------------------
> <action
>    path="/relay"
>    type="app.forms.RelayAction">
> </action>
> 
> I now know that calling "Logon.do" was able to load the form because when LogonAction fails, it forwards control to the "input" page, which is set to "/logon.jsp" above. The LogonAction code that does this is below:
> 
> if (!errors.empty()) {
>    saveErrors(request, errors);
>    return (new ActionForward(mapping.getInput()));
> }
> 
> I don't understand why LogonAction class is able to load LogonForm using mapping.getInput() and the RelayAction cannot using mapping.findForward? They both return ActionForward. Can it be because there is a difference between mapping.getInput() and mapping.findForward()!?
> 
> If you've got pointers, please point-on. I need help here.
> 
> (going home now...)
> 
> Carlos Ortega




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Can V in MVC be Swing in Struts?

Posted by Xue-Feng Yang <ju...@yahoo.com>.
The response could be a String, an XML, a HTML or a
HexString.

I am wondering if I can make a JSP without HTML tags.
If this is the case, then the thing can be done. So
far, I use servlet to do this. It would be nice if I
can built on Struts.
 
--- Andrew Hill <an...@gridnode.com>
wrote:
> Ah well in that case yes, I dont see why not.
> Didnt think of that scenario!
> 
> What sort of response would you be returning to this
> swing client? xml?
> 
> -----Original Message-----
> From: Xue-Feng Yang [mailto:just4look@yahoo.com]
> Sent: Thursday, October 17, 2002 11:57
> To: Struts Users Mailing List;
> andrew.david.hill@gridnode.com
> Subject: RE: Can V in MVC be Swing in Struts?
> 
> 
> The Swing app I mentioned talks to servlets via
> HTTP/HTTPS.
> 
>  --- Andrew Hill <an...@gridnode.com>
> wrote: > Practically speaking no - as Struts is very
> much web
> > oriented and reliant on
> > a lot of the servlet container functionality (ie:
> > requests and responses,
> > etc...).
> >
> >
> > -----Original Message-----
> > From: Xue-Feng Yang [mailto:just4look@yahoo.com]
> > Sent: Thursday, October 17, 2002 11:48
> > To: Struts Users Mailing List
> > Subject: Can V in MVC be Swing in Struts?
> >
> >
> > Can V in MVC be Swing in Struts?
> >
> >
>
______________________________________________________________________
> > Post your free ad now! http://personals.yahoo.ca
> >
> > --
> > To unsubscribe, e-mail:
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
>
______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Can V in MVC be Swing in Struts?

Posted by Andrew Hill <an...@gridnode.com>.
Ah well in that case yes, I dont see why not.
Didnt think of that scenario!

What sort of response would you be returning to this swing client? xml?

-----Original Message-----
From: Xue-Feng Yang [mailto:just4look@yahoo.com]
Sent: Thursday, October 17, 2002 11:57
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: RE: Can V in MVC be Swing in Struts?


The Swing app I mentioned talks to servlets via
HTTP/HTTPS.

 --- Andrew Hill <an...@gridnode.com>
wrote: > Practically speaking no - as Struts is very
much web
> oriented and reliant on
> a lot of the servlet container functionality (ie:
> requests and responses,
> etc...).
>
>
> -----Original Message-----
> From: Xue-Feng Yang [mailto:just4look@yahoo.com]
> Sent: Thursday, October 17, 2002 11:48
> To: Struts Users Mailing List
> Subject: Can V in MVC be Swing in Struts?
>
>
> Can V in MVC be Swing in Struts?
>
>
______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Can V in MVC be Swing in Struts?

Posted by Xue-Feng Yang <ju...@yahoo.com>.
The Swing app I mentioned talks to servlets via
HTTP/HTTPS. 

 --- Andrew Hill <an...@gridnode.com>
wrote: > Practically speaking no - as Struts is very
much web
> oriented and reliant on
> a lot of the servlet container functionality (ie:
> requests and responses,
> etc...).
> 
> 
> -----Original Message-----
> From: Xue-Feng Yang [mailto:just4look@yahoo.com]
> Sent: Thursday, October 17, 2002 11:48
> To: Struts Users Mailing List
> Subject: Can V in MVC be Swing in Struts?
> 
> 
> Can V in MVC be Swing in Struts?
> 
>
______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>  

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Can V in MVC be Swing in Struts?

Posted by Andrew Hill <an...@gridnode.com>.
Practically speaking no - as Struts is very much web oriented and reliant on
a lot of the servlet container functionality (ie: requests and responses,
etc...).


-----Original Message-----
From: Xue-Feng Yang [mailto:just4look@yahoo.com]
Sent: Thursday, October 17, 2002 11:48
To: Struts Users Mailing List
Subject: Can V in MVC be Swing in Struts?


Can V in MVC be Swing in Struts?

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Can V in MVC be Swing in Struts?

Posted by Xue-Feng Yang <ju...@yahoo.com>.
Can V in MVC be Swing in Struts?

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>