In search1Action, is the whole form null? Without seeing the relevant
parts of struts-config nor the form bean declaration, I can only
guess. There could be a typo in your struts-config for the action or
the form bean getter/setter declaration. Also, this isn't causing your
problem, but you assign your form to header1Form_ but then continue to
use a cast with the original form when you could just use the
header1form_ instance variable without a cast.

Also, a style point, by convention the names of classes are capitalized in Java.

-ed

On 7/27/05, Chris Pat <[EMAIL PROTECTED]> wrote:
> Hello
> I have been trying for too long to get this simply to
> work.  Below is very simple code that fails at the
> first attempt to retrieve the form bean method.  What
> can possibly be wrong, it gives compiles, gives a NPE.
>  The form bean variables are ="" in the reset method.
> I do know how to do it as the example further below
> works fine.  Please advise.
> 
> public class search1Action extends Action {
>     public ActionForward execute(ActionMapping
> actionMapping,
>                                  ActionForm form,
>                                  HttpServletRequest
> request,
>                                  HttpServletResponse
> response) {
>         header1Form header1Form_ = (header1Form) form;
>         String queryString =
> ((header1Form)form).getQuery();
>         String animalType =
> ((header1Form)form).getAnimalType();
> 
> This works fine:
> public class min01Action extends Action {
>     public ActionForward execute(ActionMapping
> actionMapping,
>                                  ActionForm form,
>                                  HttpServletRequest
> request,
>                                  HttpServletResponse
> response) {
> 
>         min01Form min01Form_ = (min01Form)form;
>         String fromAction =
> ((min01Form)form).getSample().toUpperCase();
>         String fromAction2 =
> ((min01Form)form).getSample2().toUpperCase();
>         HttpSession session = request.getSession();
>         session.setAttribute("fromAction",fromAction);
> 
> session.setAttribute("fromAction2",fromAction2);
>         return (actionMapping.findForward("success"));
>     }
> }
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to