aspose file tools*
The moose likes Struts and the fly likes  The requested resource (There is no Action mapped for namespace / and action name admin-login.) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " The requested resource (There is no Action mapped for namespace / and action name admin-login.)" Watch " The requested resource (There is no Action mapped for namespace / and action name admin-login.)" New topic
Author

The requested resource (There is no Action mapped for namespace / and action name admin-login.)

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 67
Hi,

I making an struts2 application which having some exception i not getting what is the problem please gave me hing which i can correct and run the application

I suffering following error


WARNING: Could not find action or result
There is no Action mapped for namespace / and action name admin-login. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)



struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.devMode" value="true" />

<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
</result-types>

<action name="welcomeLink">
<result type="tiles">baseLayout</result>
</action>

<action name="admin-login" class="com.suraj.AdminLoginAction" method="admin">
<result name="admin" type="tiles">admin.tiles</result>
</action>

<action name="contactUs" class="com.suraj.AdminLoginAction" method="getContactUs">
<result name="contactUs" type="tiles">contactUs.tiles</result>
</action>

<action name="aboutUs" class="com.suraj.AdminLoginAction" method="getAboutUs">
<result name="aboutUs" type="tiles">aboutUs.tiles</result>
</action>
</package>

</struts>


header.jsp inside home_screen_pages folder


<%@page import="java.io.PrintWriter"%>
<%@page import="freemarker.ext.servlet.HttpSessionHashModel"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%@page import="javax.servlet.http.*"%>


<html>
<head>
<link href="css_files/search_button.css" rel="stylesheet"
type="text/css" />
<style type="text/css">
body {
font-size: .90em;
font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial,
Helvetica, Verdana, sans-serif;
margin: 2px;
padding: 2px;
height: 780px;
}
</style>
</head>
<body>
<table height="100%" width="100%">
<tr>
<td align="left" nowrap="nowrap"><img alt="Book My Movie"
src="images/mlogo_1.jpg" height="100" width="100"></td>
<td align="left" nowrap="nowrap">
<div align="left" id="moviesname">Book My Movie</div>
</td>

<td align="right" nowrap="nowrap" colspan="5">
<div align="right">
<s:form id="seach_id">
<div align="right">
<input id="submitbutton" type="submit" value="Search" />
</div>
<div align="left">
<s:textfield id="searchtextfield" name="search" size="25">
</s:textfield>
</div>
</s:form>
</div> <%
try
{
session = request.getSession(false);
%>

<div align="right" id="aboutus_contactus_login_logout">
<table height="" width="30%" align="right" border="0" id="all">
<tr>
<td><s:form action="contactUs.actoin">
<s:submit id="contactus" value="Contact Us"></s:submit>
</s:form></td>
<td><s:form action="aboutUs.action">
<s:submit id="aboutus" value="About Us"></s:submit>
</s:form></td>
<td>
<%
if(session==null)
{
%> <s:a href="admin-login.action">
<input type="button" id="contactus" value="Login"
title="Login"> </s:a>
<%
}
else
{
%> <s:a href="admin-login.action">
<input type="button" id="contactus" value="Logout"
title="Login"> </s:a>
<%
}
%>
</td>
</tr>
</table>
</div> <%
}
catch(NullPointerException e)
{
e.printStackTrace();
e.getCause();
e.getMessage();
}
%>
</td>

</tr>
</table>
</body>
</html>

I try to link the action with struts action but i couldn't found please help out me .

I attached my eclipse project layout with image file as a reference.

Thanks...


[struts2Layout.jpg]

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 67
tiles.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

<definition name="baseLayout" template="/first_base_layout.jsp">
<put-attribute name="title" value="Welcome to Book My Movie" />
<put-attribute name="header" value="/home_screen_pages/header.jsp" />
<put-attribute name="slide" value="/home_screen_pages/movie_slide.jsp" />
<put-attribute name="area_time" value="/home_screen_pages/area_time.jsp" />
<put-attribute name="movie_list" value="/home_screen_pages/movie_list.jsp" />
<put-attribute name="news" value="/home_screen_pages/news.jsp" />
<put-attribute name="footer" value="/home_screen_pages/footer.jsp" />
</definition>

<definition name="admin.tiles" extends="baseLayout">
<put-attribute name="movie_list" value="/home_screen_pages/adminlogin.jsp" />
</definition>

<definition name="contactUs.tiles" extends="baseLayout">
<put-attribute name="movie_list" value="/home_screen_pages/contactus.jsp" />
</definition>

<definition name="aboutUs.tiles" extends="baseLayout">
<put-attribute name="movie_list" value="/home_screen_pages/aboutus.jsp" />
</definition>


<!--
<definition name="/customer.success.tiles" extends="baseLayout">
<put-attribute name="title" value="Customer Added" />
<put-attribute name="body" value="/SuccessCustomer.jsp" />
</definition>
-->
</tiles-definitions>


[struts2Layout.jpg]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The requested resource (There is no Action mapped for namespace / and action name admin-login.)