You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ben <be...@tiscalinet.ch> on 2003/07/07 16:05:15 UTC

notEmpty/empty and interation

Hi,

Using struts1.1 I have problems getting the iterate tag working.
the page scoped id bean for the element is never found. This happens when
the collection is empty or contains values.

Help is greatly appreciated.

Details:

I store a Collection under "oss_prod_list" in my session, with the following
jsp snippet:

<logic:empty name="oss_prod_list">
No products available.
</logic:empty>
<!-- @TODO: notEmpty tag does not work for some reason -->
<logic:notEmpty name="oss_prod_list">

<logic:iterate name="oss_prod_list" id="prod_list_el">
<td>
<bean:write name="prod_list_el" property="name" />
...
</logic:iterate>
</logic:notEmpty>


I get the empty as well as the not empty printed out when the collection is
empty or not. When i remove the content between the iterate tag my jsp
works, when not I get always (when collection is empty or not) the exception
that the id bean specified as iteration element is not found:

root cause

javax.servlet.ServletException: Cannot find bean prod_list_el in any scope
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:530)







---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: jsp links to stay within module

Posted by Jing Zhou <ji...@netspread.com>.
I forgot to tell you that you should also include
the context path in the <a href=""> tag.
The <html:link> do it for you automatically.

Jing

----- Original Message ----- 
From: "ben" <be...@tiscalinet.ch>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>; "'Jing
Zhou'" <ji...@netspread.com>
Sent: Monday, July 07, 2003 2:44 PM
Subject: RE: jsp links to stay within module


> Unfortunately this is then a absolute link to the webserver root and not
> relatively to the deployed application root. This does not work, at least
> with my setup. ;(
>
> > -----Original Message-----
> > From: Jing Zhou [mailto:jing@netspread.com]
> > Sent: Montag, 7. Juli 2003 21:28
> > To: Struts Users Mailing List; bewalther@tiscalinet.ch
> > Subject: Re: jsp links to stay within module
> >
> >
> > You might want to give a try
> > <a href="/osscatalog/prodSubmit.do">
> >
> > The leading slash is important.
> >
> > Jing
> >
> > ----- Original Message -----
> > From: "ben" <be...@tiscalinet.ch>
> > To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
> > Sent: Monday, July 07, 2003 11:15 AM
> > Subject: RE: jsp links to stay within module
> >
> >
> > > But using the switch action is a bit strange since I do not
> > want to switch
> > > module but stay in the current module.
> > >
> > > Hm however if the module is only request scoped... ???
> > >
> > > > -----Original Message-----
> > > > From: Sandeep Takhar [mailto:sandeep_takhar@yahoo.com]
> > > > Sent: Montag, 7. Juli 2003 17:59
> > > > To: Struts Users Mailing List; bewalther@tiscalinet.ch
> > > > Subject: Re: jsp links to stay within module
> > > >
> > > >
> > > > there is a SwitchAction that you can use.
> > > >
> > > > someone else probably has more details...
> > > > sandeep
> > > > --- ben <be...@tiscalinet.ch> wrote:
> > > > > Hi,
> > > > >
> > > > > I link 2 jsp's in moduleA (=not default module).
> > > > > In order for struts to stay within moduleA i learnt
> > > > > i cannot href the jsp
> > > > > directly, because the module will then switch again
> > > > > to the default. I cannot
> > > > > make the module session persistent, right?
> > > > >
> > > > > When then using a forward action like below, I get a
> > > > > 404:
> > > > >
> > > > > message Invalid path /prodSubmit was requested
> > > > >
> > > > > source jsp:
> > > > > <a href="osscatalog/prodSubmit.do">Submit a
> > > > > Product</a><br>
> > > > >
> > > > > struts-config-moduleA.xml:
> > > > >
> > > > >       <action path="/osscatalog/prodSubmit"
> > > > >
> > > > > type="org.apache.struts.actions.ForwardAction"
> > > > >              name="prodSubmitForm"
> > > > >
> > > > > parameter="/osscatalog/prodSubmit.jsp"/>
> > > > >
> > > > >
> > > > >
> > > > > Ideas?
> > > > >
> > > > > Cheers ben
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > > > struts-user-help@jakarta.apache.org
> > > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > > http://sbc.yahoo.com
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: jsp links to stay within module

Posted by ben <be...@tiscalinet.ch>.
Unfortunately this is then a absolute link to the webserver root and not
relatively to the deployed application root. This does not work, at least
with my setup. ;(

> -----Original Message-----
> From: Jing Zhou [mailto:jing@netspread.com]
> Sent: Montag, 7. Juli 2003 21:28
> To: Struts Users Mailing List; bewalther@tiscalinet.ch
> Subject: Re: jsp links to stay within module
>
>
> You might want to give a try
> <a href="/osscatalog/prodSubmit.do">
>
> The leading slash is important.
>
> Jing
>
> ----- Original Message -----
> From: "ben" <be...@tiscalinet.ch>
> To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
> Sent: Monday, July 07, 2003 11:15 AM
> Subject: RE: jsp links to stay within module
>
>
> > But using the switch action is a bit strange since I do not
> want to switch
> > module but stay in the current module.
> >
> > Hm however if the module is only request scoped... ???
> >
> > > -----Original Message-----
> > > From: Sandeep Takhar [mailto:sandeep_takhar@yahoo.com]
> > > Sent: Montag, 7. Juli 2003 17:59
> > > To: Struts Users Mailing List; bewalther@tiscalinet.ch
> > > Subject: Re: jsp links to stay within module
> > >
> > >
> > > there is a SwitchAction that you can use.
> > >
> > > someone else probably has more details...
> > > sandeep
> > > --- ben <be...@tiscalinet.ch> wrote:
> > > > Hi,
> > > >
> > > > I link 2 jsp's in moduleA (=not default module).
> > > > In order for struts to stay within moduleA i learnt
> > > > i cannot href the jsp
> > > > directly, because the module will then switch again
> > > > to the default. I cannot
> > > > make the module session persistent, right?
> > > >
> > > > When then using a forward action like below, I get a
> > > > 404:
> > > >
> > > > message Invalid path /prodSubmit was requested
> > > >
> > > > source jsp:
> > > > <a href="osscatalog/prodSubmit.do">Submit a
> > > > Product</a><br>
> > > >
> > > > struts-config-moduleA.xml:
> > > >
> > > >       <action path="/osscatalog/prodSubmit"
> > > >
> > > > type="org.apache.struts.actions.ForwardAction"
> > > >              name="prodSubmitForm"
> > > >
> > > > parameter="/osscatalog/prodSubmit.jsp"/>
> > > >
> > > >
> > > >
> > > > Ideas?
> > > >
> > > > Cheers ben
> > > >
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: jsp links to stay within module

Posted by Jing Zhou <ji...@netspread.com>.
You might want to give a try
<a href="/osscatalog/prodSubmit.do">

The leading slash is important.

Jing

----- Original Message ----- 
From: "ben" <be...@tiscalinet.ch>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Monday, July 07, 2003 11:15 AM
Subject: RE: jsp links to stay within module


> But using the switch action is a bit strange since I do not want to switch
> module but stay in the current module.
>
> Hm however if the module is only request scoped... ???
>
> > -----Original Message-----
> > From: Sandeep Takhar [mailto:sandeep_takhar@yahoo.com]
> > Sent: Montag, 7. Juli 2003 17:59
> > To: Struts Users Mailing List; bewalther@tiscalinet.ch
> > Subject: Re: jsp links to stay within module
> >
> >
> > there is a SwitchAction that you can use.
> >
> > someone else probably has more details...
> > sandeep
> > --- ben <be...@tiscalinet.ch> wrote:
> > > Hi,
> > >
> > > I link 2 jsp's in moduleA (=not default module).
> > > In order for struts to stay within moduleA i learnt
> > > i cannot href the jsp
> > > directly, because the module will then switch again
> > > to the default. I cannot
> > > make the module session persistent, right?
> > >
> > > When then using a forward action like below, I get a
> > > 404:
> > >
> > > message Invalid path /prodSubmit was requested
> > >
> > > source jsp:
> > > <a href="osscatalog/prodSubmit.do">Submit a
> > > Product</a><br>
> > >
> > > struts-config-moduleA.xml:
> > >
> > >       <action path="/osscatalog/prodSubmit"
> > >
> > > type="org.apache.struts.actions.ForwardAction"
> > >              name="prodSubmitForm"
> > >
> > > parameter="/osscatalog/prodSubmit.jsp"/>
> > >
> > >
> > >
> > > Ideas?
> > >
> > > Cheers ben
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: jsp links to stay within module

Posted by ben <be...@tiscalinet.ch>.
But using the switch action is a bit strange since I do not want to switch
module but stay in the current module.

Hm however if the module is only request scoped... ???

> -----Original Message-----
> From: Sandeep Takhar [mailto:sandeep_takhar@yahoo.com]
> Sent: Montag, 7. Juli 2003 17:59
> To: Struts Users Mailing List; bewalther@tiscalinet.ch
> Subject: Re: jsp links to stay within module
>
>
> there is a SwitchAction that you can use.
>
> someone else probably has more details...
> sandeep
> --- ben <be...@tiscalinet.ch> wrote:
> > Hi,
> >
> > I link 2 jsp's in moduleA (=not default module).
> > In order for struts to stay within moduleA i learnt
> > i cannot href the jsp
> > directly, because the module will then switch again
> > to the default. I cannot
> > make the module session persistent, right?
> >
> > When then using a forward action like below, I get a
> > 404:
> >
> > message Invalid path /prodSubmit was requested
> >
> > source jsp:
> > <a href="osscatalog/prodSubmit.do">Submit a
> > Product</a><br>
> >
> > struts-config-moduleA.xml:
> >
> >       <action path="/osscatalog/prodSubmit"
> >
> > type="org.apache.struts.actions.ForwardAction"
> >              name="prodSubmitForm"
> >
> > parameter="/osscatalog/prodSubmit.jsp"/>
> >
> >
> >
> > Ideas?
> >
> > Cheers ben
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: jsp links to stay within module

Posted by Sandeep Takhar <sa...@yahoo.com>.
there is a SwitchAction that you can use.

someone else probably has more details...
sandeep
--- ben <be...@tiscalinet.ch> wrote:
> Hi,
> 
> I link 2 jsp's in moduleA (=not default module).
> In order for struts to stay within moduleA i learnt
> i cannot href the jsp
> directly, because the module will then switch again
> to the default. I cannot
> make the module session persistent, right?
> 
> When then using a forward action like below, I get a
> 404:
> 
> message Invalid path /prodSubmit was requested
> 
> source jsp:
> <a href="osscatalog/prodSubmit.do">Submit a
> Product</a><br>
> 
> struts-config-moduleA.xml:
> 
>       <action path="/osscatalog/prodSubmit"
>             
> type="org.apache.struts.actions.ForwardAction"
>              name="prodSubmitForm"
>             
> parameter="/osscatalog/prodSubmit.jsp"/>
> 
> 
> 
> Ideas?
> 
> Cheers ben
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


jsp links to stay within module

Posted by ben <be...@tiscalinet.ch>.
Hi,

I link 2 jsp's in moduleA (=not default module).
In order for struts to stay within moduleA i learnt i cannot href the jsp
directly, because the module will then switch again to the default. I cannot
make the module session persistent, right?

When then using a forward action like below, I get a 404:

message Invalid path /prodSubmit was requested

source jsp:
<a href="osscatalog/prodSubmit.do">Submit a Product</a><br>

struts-config-moduleA.xml:

      <action path="/osscatalog/prodSubmit"
             type="org.apache.struts.actions.ForwardAction"
             name="prodSubmitForm"
             parameter="/osscatalog/prodSubmit.jsp"/>



Ideas?

Cheers ben



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: notEmpty/empty and interation

Posted by ben <be...@tiscalinet.ch>.
;) that was it forgot to declare the taglib. thanks.

> -----Original Message-----
> From: Sandeep Takhar [mailto:sandeep_takhar@yahoo.com]
> Sent: Montag, 7. Juli 2003 16:59
> To: Struts Users Mailing List; bewalther@tiscalinet.ch
> Subject: Re: notEmpty/empty and interation
> 
> 
> also check to see if you have logic taglib api
> defined.  If it is not, then check your source and you
> will see the xml .. <logic:iterate   right in the
> source.
> 
> 
> sandeep
> --- ben <be...@tiscalinet.ch> wrote:
> > Hi,
> > 
> > Using struts1.1 I have problems getting the iterate
> > tag working.
> > the page scoped id bean for the element is never
> > found. This happens when
> > the collection is empty or contains values.
> > 
> > Help is greatly appreciated.
> > 
> > Details:
> > 
> > I store a Collection under "oss_prod_list" in my
> > session, with the following
> > jsp snippet:
> > 
> > <logic:empty name="oss_prod_list">
> > No products available.
> > </logic:empty>
> > <!-- @TODO: notEmpty tag does not work for some
> > reason -->
> > <logic:notEmpty name="oss_prod_list">
> > 
> > <logic:iterate name="oss_prod_list"
> > id="prod_list_el">
> > <td>
> > <bean:write name="prod_list_el" property="name" />
> > ...
> > </logic:iterate>
> > </logic:notEmpty>
> > 
> > 
> > I get the empty as well as the not empty printed out
> > when the collection is
> > empty or not. When i remove the content between the
> > iterate tag my jsp
> > works, when not I get always (when collection is
> > empty or not) the exception
> > that the id bean specified as iteration element is
> > not found:
> > 
> > root cause
> > 
> > javax.servlet.ServletException: Cannot find bean
> > prod_list_el in any scope
> > 	at
> >
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImp
> > l.java:530)
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: notEmpty/empty and interation

Posted by Sandeep Takhar <sa...@yahoo.com>.
also check to see if you have logic taglib api
defined.  If it is not, then check your source and you
will see the xml .. <logic:iterate   right in the
source.


sandeep
--- ben <be...@tiscalinet.ch> wrote:
> Hi,
> 
> Using struts1.1 I have problems getting the iterate
> tag working.
> the page scoped id bean for the element is never
> found. This happens when
> the collection is empty or contains values.
> 
> Help is greatly appreciated.
> 
> Details:
> 
> I store a Collection under "oss_prod_list" in my
> session, with the following
> jsp snippet:
> 
> <logic:empty name="oss_prod_list">
> No products available.
> </logic:empty>
> <!-- @TODO: notEmpty tag does not work for some
> reason -->
> <logic:notEmpty name="oss_prod_list">
> 
> <logic:iterate name="oss_prod_list"
> id="prod_list_el">
> <td>
> <bean:write name="prod_list_el" property="name" />
> ...
> </logic:iterate>
> </logic:notEmpty>
> 
> 
> I get the empty as well as the not empty printed out
> when the collection is
> empty or not. When i remove the content between the
> iterate tag my jsp
> works, when not I get always (when collection is
> empty or not) the exception
> that the id bean specified as iteration element is
> not found:
> 
> root cause
> 
> javax.servlet.ServletException: Cannot find bean
> prod_list_el in any scope
> 	at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:530)
> 
> 
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: notEmpty/empty and interation

Posted by Sandeep Takhar <sa...@yahoo.com>.
seems right.

what happens if you just print "hello" in between the
tags?  Does it print the correct number of times?

sandeep
--- ben <be...@tiscalinet.ch> wrote:
> Hi,
> 
> Using struts1.1 I have problems getting the iterate
> tag working.
> the page scoped id bean for the element is never
> found. This happens when
> the collection is empty or contains values.
> 
> Help is greatly appreciated.
> 
> Details:
> 
> I store a Collection under "oss_prod_list" in my
> session, with the following
> jsp snippet:
> 
> <logic:empty name="oss_prod_list">
> No products available.
> </logic:empty>
> <!-- @TODO: notEmpty tag does not work for some
> reason -->
> <logic:notEmpty name="oss_prod_list">
> 
> <logic:iterate name="oss_prod_list"
> id="prod_list_el">
> <td>
> <bean:write name="prod_list_el" property="name" />
> ...
> </logic:iterate>
> </logic:notEmpty>
> 
> 
> I get the empty as well as the not empty printed out
> when the collection is
> empty or not. When i remove the content between the
> iterate tag my jsp
> works, when not I get always (when collection is
> empty or not) the exception
> that the id bean specified as iteration element is
> not found:
> 
> root cause
> 
> javax.servlet.ServletException: Cannot find bean
> prod_list_el in any scope
> 	at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:530)
> 
> 
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org