You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Keith Sader <ks...@gmail.com> on 2006/01/09 19:16:42 UTC

Making submenus with tiles

Greetings, I've google'd the web and I haven't found any good advice
on how to make submenus with tiles.

What I have is a menu structure like this

Item1
  subitem1
  subitem2
Item2
  subitem2
  subitem2
...

How would I define this in a tiles-def?  What I have so far is
something that looks like this:

<definition name="left.menu" path="/common/leftMenu.jsp" >
	<putList name="menuItems">
		<putList name="Item1">
			<item value="subitem1" link="#"/>
			<item value="subitem1" link="#/>
			<item value="subitem1" link="#"/>
		</putList>
		<putList name="Item2">
			<item value="subitem2" link="#"/>
			<item value="subitem2" link="#/>
			<item value="subitem2" link="#"/>
		</putList>
	</putList>
</definition>

However, this makes the iteration over the items ugly in the .jsp.  Is
there an easier/better way to get what I'm after?

thanks,
--
Keith Sader
ksader@gmail.com
http://www.saderfamily.org/roller/page/ksader

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


Re: Null actionform

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi,

I don't know if there is a way to tell Struts to give you an empty
ActionForm, I suspect not, but you can always do it yourself in your
Action:

if (actionForm == null) {
  actionForm = RequestUtils.createActionForm(request, mapping,
mapping.getModuleConfig(), getServlet());
}

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

On Mon, January 9, 2006 1:53 pm, Xavier Vanderstukken said:
> Sometimes in my application, I call an action by this way :
>
> <html:link action="/list.do" ................
>
> In this case the ActionForm received in my struts action is null, is it
> a way to obtain an empty form instead of a null form? (Of course not by
> using a html:form)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: Null actionform

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Good catch Wendy!  I jumped right to trying to get what he asked for and I
didn't even stop to think about WHY he was getting it in the first place
:(

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

On Mon, January 9, 2006 2:15 pm, Xavier Vanderstukken said:
> Wendy Smoak wrote:
>
>>On 1/9/06, Xavier Vanderstukken <xv...@ionicsoft.com> wrote:
>>
>>
>>
>>>Sometimes in my application, I call an action by this way :
>>>
>>><html:link action="/list.do" ................
>>>
>>>In this case the ActionForm received in my struts action is null,
>>>
>>>
>>
>>Null usually means no form bean is associated with the Action.  What
>>does the action mapping in struts-config.xml look like?
>>
>>--
>>Wendy
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
> Nice advice ;-)
> I was missing that attribute in this action
>
>


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


Re: Null actionform

Posted by Xavier Vanderstukken <xv...@ionicsoft.com>.
Wendy Smoak wrote:

>On 1/9/06, Xavier Vanderstukken <xv...@ionicsoft.com> wrote:
>
>  
>
>>Sometimes in my application, I call an action by this way :
>>
>><html:link action="/list.do" ................
>>
>>In this case the ActionForm received in my struts action is null,
>>    
>>
>
>Null usually means no form bean is associated with the Action.  What
>does the action mapping in struts-config.xml look like?
>
>--
>Wendy
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>
Nice advice ;-)
I was missing that attribute in this action


Re: Null actionform

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/9/06, Xavier Vanderstukken <xv...@ionicsoft.com> wrote:

> Sometimes in my application, I call an action by this way :
>
> <html:link action="/list.do" ................
>
> In this case the ActionForm received in my struts action is null,

Null usually means no form bean is associated with the Action.  What
does the action mapping in struts-config.xml look like?

--
Wendy

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


Null actionform

Posted by Xavier Vanderstukken <xv...@ionicsoft.com>.
Sometimes in my application, I call an action by this way :

<html:link action="/list.do" ................

In this case the ActionForm received in my struts action is null, is it 
a way to obtain an empty form instead of a null form? (Of course not by 
using a html:form)


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


Re: Making submenus with tiles

Posted by Mark Lowe <me...@gmail.com>.
You could create your own bean with nested menuitems,

class MenuItem {
   ...
    List getItems() {
       return items;
    }
   ...
    void addMenuItem(MenuItem item) {
       this.items.add(item);
    }

    //and so on
}

You can use <bean /> in tiles config, tiles controller or even a
servlet that places the menu in the application context (no tiles).
The tiles config gets a but uglier (if you go that route) , but jsps
come out cleaner..

mark



On 1/9/06, Keith Sader <ks...@gmail.com> wrote:
> Greetings, I've google'd the web and I haven't found any good advice
> on how to make submenus with tiles.
>
> What I have is a menu structure like this
>
> Item1
>   subitem1
>   subitem2
> Item2
>   subitem2
>   subitem2
> ...
>
> How would I define this in a tiles-def?  What I have so far is
> something that looks like this:
>
> <definition name="left.menu" path="/common/leftMenu.jsp" >
>         <putList name="menuItems">
>                 <putList name="Item1">
>                         <item value="subitem1" link="#"/>
>                         <item value="subitem1" link="#/>
>                         <item value="subitem1" link="#"/>
>                 </putList>
>                 <putList name="Item2">
>                         <item value="subitem2" link="#"/>
>                         <item value="subitem2" link="#/>
>                         <item value="subitem2" link="#"/>
>                 </putList>
>         </putList>
> </definition>
>
> However, this makes the iteration over the items ugly in the .jsp.  Is
> there an easier/better way to get what I'm after?
>
> thanks,
> --
> Keith Sader
> ksader@gmail.com
> http://www.saderfamily.org/roller/page/ksader
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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