You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Konstantina Stamopoulou <st...@intracom.gr> on 2002/02/14 10:36:14 UTC

Form bean -> null

Hello,
I need to use a  form bean  in struts and this is the first time I'm doing that .So as newbie I feel I'm missing something basic. Can U help me? This is my case.
I have my struts-config :

 <form-beans>
   <form-bean      name="MyForm" type="provider.test.MyForm"/>
</form-beans>


 <action    path="/editStream"
                type="provider.test.MyFormAction"
                name="MyForm"
                scope="request"
                validate="false">
      <forward name="success"              path="/streaming.jsp"/>
 </action>   


I have MyForm Bean with set and get methods and I have MyForm Action   which just initializes my form:


.........................

if (form == null) {
  
  System.out.println("Form is null");
            
     form = new MyForm();
            if ("request".equals(mapping.getScope()))
                request.setAttribute(mapping.getAttribute(), form);
            else
                session.setAttribute(mapping.getAttribute(), form);
 }
 MyForm strmform = (MyForm) form;

and finally my .jsp is the following:

<html:form action="/details" >
   <tr> <font size="5" color="#0000A0"> Destination IP Address : </font> 
        <html:text  property="ip1" size="3" /> <font color="#0000A0"> . </font>
        <html:text  property="ip2" size="3" /> <font color="#0000A0"> . </font>
        <html:text  property="ip3" size="3" /> <font color="#0000A0"> . </font>
        <html:text  property="ip4" size="3" /> <font color="#0000A0"> . </font>
   </tr>     
   <tr> <html:text  property="port" size="3" /> <font color="#0000A0"> </tr>
   <tr> <html:text  property="lan" size="3" /> <font color="#0000A0"> </tr>
   <tr> <html:text  property="autostart" size="3" /> <font color="#0000A0"> </tr>   
    
   
 </html:form>     


When I callthis page I get a :

javax.servlet.ServletException: Cannot retrieve definition for form bean null

error, and I cannot fingure out what I 'm doing wrong.

I would appriciated if U could provide me with any info regarding this problem.

Thank U in advance,
Konstantina



Re: logic:iterate question

Posted by Oliver Kiessler <ki...@linustar.de>.
thanks! thats it. now it works... ;)

oli

Am Don, 2002-02-14 um 12.13 schrieb Ivan Siviero:
> > links like this: <a href=ViewHeadlineAction.do?headlineID=X>XYZ</a>
> supposing the logic:iterate id paramenter is set to "element"
> It should be something like this
> 
> <html:link page="ViewHeadlineAction.do" paramName="element"
> paramId="headlineID" paramPropery="getterMethodWhoReturnsX">
> 
>  instead of the static <a></a>
> 
> checks this document http://jakarta.apache.org/struts/struts-html.html for
> <html:link> reference doc.
> 
> Hope this helps.
> 
> > --
> > 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>
> 
> 
-- 
mailto: kiessler@linustar.de
web: http://www.linustar.de
gnupg key: http://www.linustar.de/pgp/kiessler.gpg
icq: 136832122
---
The more I question the origin and meaning of our existence, the
less I care. And the less I care, the more I question myself.


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


Re: logic:iterate question

Posted by Ivan Siviero <iv...@concept.it>.
> links like this: <a href=ViewHeadlineAction.do?headlineID=X>XYZ</a>
supposing the logic:iterate id paramenter is set to "element"
It should be something like this

<html:link page="ViewHeadlineAction.do" paramName="element"
paramId="headlineID" paramPropery="getterMethodWhoReturnsX">

 instead of the static <a></a>

checks this document http://jakarta.apache.org/struts/struts-html.html for
<html:link> reference doc.

Hope this helps.

> --
> 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: logic:iterate question

Posted by Konstantina Stamopoulou <st...@intracom.gr>.
Hi ,

>From what I understand you want to create links for each headline and pass
the head line as a parameter.
So inside the logic:iterate tag U should put :
<logic:iterate.................>
 <jsp:useBean id="info" class="java.util.HashMap"/>
   <%info.put("HeadLineID", "X"); %>

  <html:link page="/details.do" name="info"> Headline </html:link>
</logic:iterate>

U can replace the one line of code with <jsp:setProperty ....of the bean
info>

It worked for me.

Konstantina


---Original Message -----
From: "Oliver Kiessler" <ki...@linustar.de>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, February 14, 2002 12:58 PM
Subject: logic:iterate question


> hello,
> i have a problem on one of my "views" with a logic:iterate tag. i have
> an "action" that fetches news headlines from a database
> (headline,headlineID) and stores them in a bean
> (headlines->Arraylist,headlinedID->Vector) which is appended to
> request/session. On the "view" i want to iterate through the Arraylist
> with the headlines which basically works fine. but i need to create
> links like this: <a href=ViewHeadlineAction.do?headlineID=X>XYZ</a>
>
> how would i use the iterate tag? do i have to use the nested tag? (i am
> currently using struts 1.0.2) i dont want to use any "java code" in my
> view, only tags...
>
> thanks, oli
>
>
> --
> 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>


logic:iterate question

Posted by Oliver Kiessler <ki...@linustar.de>.
hello,
i have a problem on one of my "views" with a logic:iterate tag. i have
an "action" that fetches news headlines from a database
(headline,headlineID) and stores them in a bean
(headlines->Arraylist,headlinedID->Vector) which is appended to
request/session. On the "view" i want to iterate through the Arraylist
with the headlines which basically works fine. but i need to create
links like this: <a href=ViewHeadlineAction.do?headlineID=X>XYZ</a>

how would i use the iterate tag? do i have to use the nested tag? (i am
currently using struts 1.0.2) i dont want to use any "java code" in my
view, only tags...

thanks, oli


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