adding action mapping to struts-config file in struts

R

ros

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="footer" value="/WEB-INF/jsp/common/footer.jsp"/>
<put name="hellotile" value="/WEB-INF/jsp/common/
hellotile.jsp"/>
</definition>

<definition name=".helloWorld" extends=".baseLayout">
</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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top