Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > adding action mapping to struts-config file in struts

Reply
Thread Tools

adding action mapping to struts-config file in struts

 
 
ros
Guest
Posts: n/a
 
      05-15-2007
Hello,

I have 2 hyperlinks on a jsp page in my Struts with Tiles application.
I am a bit confused about how to write the action-mapping for these
links in the struts-config file.

Would be really thankful if someone helps me with this. I have pasted
the files below.

Thanks
Ros

menu.jsp
-------------

<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>

<div><H2>Menu Items</H2>
<p></p>
<p><a href="/helloworld.jsp">Hello World</a></p>
<p><a href="/hellotile.jsp">Hello Tile</a></p>
</div>

tiles-defs.xml
-------------------

<definition name=".baseLayout" path="/WEB-INF/jsp/layouts/
baselayout.jsp">
<put name="title" value="Base Layout"/>
<put name="header" value="/WEB-INF/jsp/common/header.jsp"/>
<put name="menu" value="/WEB-INF/jsp/common/menu.jsp"/
>

<put name="footer" value="/WEB-INF/jsp/common/footer.jsp"/>
<put name="hellotile" value="/WEB-INF/jsp/common/
hellotile.jsp"/>
</definition>

<definition name=".helloWorld" extends=".baseLayout">
<put name="title" value="Hello World"/>
<put name="content" value="/WEB-INF/jsp/pages/helloworld.jsp"/
>

</definition >

struts-config.xml
------------------------

<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/welcome"
forward=".helloWorld"/>

<action
path="/helloworld"
forward=".helloWorld"/>

<action
path="/hellotile"
forward="hellotile.jsp"/>

</action-mappings>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Struts] action mapping to jsp pages under WEB-INF mlubino@gmail.com Java 1 02-24-2007 04:02 AM
Struts mapping action to action??? runescience Java 3 02-07-2006 04:07 PM
Struts - get action mapping name Hgjhghjgjhg Hgjhghjg Java 1 07-19-2004 08:47 AM
struts action url mapping that allows to split actions into restricted and unrestricted Pavel Java 1 11-14-2003 03:23 PM
struts action mapping input attribute - dynamic value ? Pavel Java 2 10-20-2003 04:33 PM



Advertisments