You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin HaleBoyes <kz...@yahoo.com> on 2002/10/01 17:22:55 UTC

struts-config.xml question

I'm looking at the struts-example and its struts-config.xml file.

In the <action> section for editRegistration, 'attribute' is set
to 'registrationForm'.  As I understand it (from the DTD), attribute
is the name of the scoped (session or request) attribute that is used
to access the ActionForm bean.

Now in the <action> section for saveRegistration 'name' is set
to 'registrationForm'.  'name' is the name of the form bean that is
associated with this mapping.

What is the difference between 'attribute' and 'name'?
It seems that they are the same thing.  Is this true?

Looking at the source for the edit and save registration actions,
they both call mapping.getAttribute() to get the name of the
ActionForm bean.  Why does that work for the saveRegistration
action when it doesn't even have an 'attribute' defined for its
<action>?

Why doesn't saveRegistration use 'attribute' instead of 'name'?

Thanks,
Kevin.


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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


DanaFormBean question

Posted by Dan Tran <da...@hotmail.com>.
Hi I have a subapp  (app1) which I'd like to do the
following action:

     - Call "start.do" with static forward to jsp page
        (query.jsp) which has a form using action "query.do"

      - The query.do uses a DanaFormBean "QueryForm"


I also make sure have all the controlIDs in query.jsp
and the danaformbean.

When I call start.do and forward seem work, but I
receive an exception   (null exception ) with the following
stack trace

java.lang.NullPointerException

java.lang.NullPointerException

 at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j
ava:1138)

 at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:751)

 at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:78
0)

 at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:728)

 at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:193)

 at org.apache.jsp.query$jsp._jspService(query$jsp.java:189)

 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

 at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:202)

 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)

 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

 at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:683)

 at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:431)

 at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:355)

 at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
14)



Please advice, I am stuck with this since yesterday


Thanks

-D

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


Re: struts-config.xml question

Posted by Emmanuel Boudrant <b7...@yahoo.fr>.
Hi,

'name' is the name of the form used by the action, this name must exist in form-beans declaration.

'attribute' is the key where the form instance will be stored in your session/request scope for
the action. by default attribute == name, but if you want, by setting 'attribute', you can change
this key.

@see the struts-config DTD, there is a lot of comment foreach element/attribute.

-emmanuel

 --- Kevin HaleBoyes <kz...@yahoo.com> a écrit : > I'm looking at the struts-example and its
struts-config.xml file.
> 
> In the <action> section for editRegistration, 'attribute' is set
> to 'registrationForm'.  As I understand it (from the DTD), attribute
> is the name of the scoped (session or request) attribute that is used
> to access the ActionForm bean.
> 
> Now in the <action> section for saveRegistration 'name' is set
> to 'registrationForm'.  'name' is the name of the form bean that is
> associated with this mapping.
> 
> What is the difference between 'attribute' and 'name'?
> It seems that they are the same thing.  Is this true?
> 
> Looking at the source for the edit and save registration actions,
> they both call mapping.getAttribute() to get the name of the
> ActionForm bean.  Why does that work for the saveRegistration
> action when it doesn't even have an 'attribute' defined for its
> <action>?
> 
> Why doesn't saveRegistration use 'attribute' instead of 'name'?
> 
> Thanks,
> Kevin.
> 
> 
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>  

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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


RE: struts-config.xml question

Posted by Victor CHEVALIER <vc...@avs-consulting.com>.
'attribute' is an alias for 'name'. if none is specified, name is used.
You can look at the javadoc of ActionMapping for complete doc on the
<action> tag.

-----Message d'origine-----
De : Kevin HaleBoyes [mailto:kzboyes@yahoo.com]
Envoye : mardi 1 octobre 2002 17:23
A : struts-user@jakarta.apache.org
Objet : struts-config.xml question


I'm looking at the struts-example and its struts-config.xml file.

In the <action> section for editRegistration, 'attribute' is set
to 'registrationForm'.  As I understand it (from the DTD), attribute
is the name of the scoped (session or request) attribute that is used
to access the ActionForm bean.

Now in the <action> section for saveRegistration 'name' is set
to 'registrationForm'.  'name' is the name of the form bean that is
associated with this mapping.

What is the difference between 'attribute' and 'name'?
It seems that they are the same thing.  Is this true?

Looking at the source for the edit and save registration actions,
they both call mapping.getAttribute() to get the name of the
ActionForm bean.  Why does that work for the saveRegistration
action when it doesn't even have an 'attribute' defined for its
<action>?

Why doesn't saveRegistration use 'attribute' instead of 'name'?

Thanks,
Kevin.


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
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>