adding action mapping to struts-config file in struts

Discussion in 'Java' started by ros, May 15, 2007.

  1. ros

    ros Guest

    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>
     
    ros, May 15, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pavel
    Replies:
    2
    Views:
    14,274
    Pavel
    Oct 20, 2003
  2. Pavel
    Replies:
    1
    Views:
    6,004
    Pavel
    Nov 14, 2003
  3. Hgjhghjgjhg Hgjhghjg

    Struts - get action mapping name

    Hgjhghjgjhg Hgjhghjg, Jul 19, 2004, in forum: Java
    Replies:
    1
    Views:
    5,007
    Murray
    Jul 19, 2004
  4. runescience

    Struts mapping action to action???

    runescience, Feb 6, 2006, in forum: Java
    Replies:
    3
    Views:
    1,925
    runescience
    Feb 7, 2006
  5. Replies:
    1
    Views:
    821
Loading...

Share This Page