Home Answers Viewqa Struts STRUTS 2 Could not find action or result

 
 


sachin negi
STRUTS 2 Could not find action or result
0 Answer(s)      a year and 3 months ago
Posted in : Struts

hiii..i am new to struts 2 framework...i developed my jsp code into sturs frame work...but its showing some warning and the "menujsp.jsp" page is not opening...its showing the following on my log:

WARNING: Could not find action or result 
There is no Action mapped for namespace [/] and action name [menujsp] associated with context path [/Basic]. - [unknown location] 
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) 
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) 
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) 
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500) 
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) 
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
at java.lang.Thread.run(Unknown Source) 

Following are the contents of my application:

ConnectionProvider.java

package pkg; 
import java.sql.Connection; 
import java.sql.DriverManager; 

public class ConnectionProvider 
{ 
public static Connection getConnection(){ 
Connection con=null; 
try{ 
Class.forName("org.postgresql.Driver"); 
con=DriverManager.getConnection("jdbc:postgresql://localhost:5433/labway","postgres","sachin"); 
} 
catch(Exception e){ 
System.out.println(e); 
} 
return con; 
} 
} 

DAO.java:

package pkg; 

import java.sql.Connection; 
import java.sql.PreparedStatement; 
import java.sql.ResultSet; 
import java.util.*; 

public class DAO 
{ 
public List<MenuList> fetch(){ 
try{ 
Connection con=ConnectionProvider.getConnection(); 
PreparedStatement stmt=con.prepareStatement("select * from application where application_id in (select distinct application_id from applicationmenu order by application_id)"); 
ResultSet rs=stmt.executeQuery(); 
ResultSet rs1=null; 
MenuList menulist; 
List<MenuList> list=new ArrayList<MenuList>(); 
while(rs.next()){ 
menulist=new MenuList(); 
menulist.setmenuId(rs.getString(1)); 
menulist.setmenuTitle(rs.getString(3)); 
PreparedStatement stmt1=con.prepareStatement("select * from menu where menu_id in (select menu_id from applicationmenu where application_id='"+rs.getString(1)+"')"); 
rs1=stmt1.executeQuery(); 
menulist.setsubmenuTitle(rs1.getString(3)); 

list.add(menulist); 
} 
return list;    
} 
catch(Exception e) 
{ 
System.out.println(e); 
} 
return null; 
} 

"MenuList.java":

package pkg; 

public class MenuList { 
String menuId; 
String menuTitle; 
String submenuTitle; 
public MenuList() 
{ 
super(); 
} 
public MenuList(String menuId,String menuTitle,String submenuTitle) 
{ 
super(); 
this.menuId=menuId; 
this.menuTitle=menuTitle; 
this.submenuTitle=submenuTitle; 
} 
public String getMenuId() 
{ 
return menuId; 
} 
public String getmenuTitle() 
{ 
return menuTitle; 
} 
public String submenuTitle() 
{ 
return submenuTitle; 
} 
public void setmenuId(String menuId) 
{ 
this.menuId = menuId; 
} 
public void setmenuTitle(String menuTitle) 
{ 
this.menuTitle = menuTitle; 
} 
public void setsubmenuTitle(String submenuTitle) 
{ 
this.submenuTitle = submenuTitle; 
} 
} 

MenuListAction.java:

package pkg; 
import java.util.*; 
import com.opensymphony.xwork2.ActionSupport; 
public class MenuListAction extends ActionSupport 
{ 
private MenuList menulist; 
private List<MenuList> menulistlist; 
DAO dao=new DAO(); 
public String execute() 
{ 
menulistlist=dao.fetch(); 
return "success"; 
} 
public MenuList getMenulist() 
{ 
return menulist; 
} 
public void setMenulist(MenuList menulist) 
{ 
this.menulist = menulist; 
} 
public List<MenuList> getMenulistlist() 
{ 
return menulistlist; 
} 
public void setMenulistlist(List<MenuList> menulistlist) 
{ 
this.menulistlist = menulistlist; 
} 

} 

web.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

<welcome-file-list> 
<welcome-file>index</welcome-file> 
</welcome-file-list> 
<filter> 
<filter-name>struts2</filter-name> 
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
</filter-class> 
</filter> 
<filter-mapping> 
<filter-name>struts2</filter-name> 
<url-pattern>/*</url-pattern> 
</filter-mapping> 
</web-app> 

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.devMode" value="true"></constant> 

<package name="Basic" extends="struts-default"> 
<action name="fetch" class="pkg.MenuListAction" method="execute"> 

<result name="success" >/menujsp.jsp</result> 
</action> 

</package> 
</struts> 

index.jsp :

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
pageEncoding="ISO-8859-1"%> 
<%@taglib uri="/struts-tags" prefix="s" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<head><title>DYNAMIC DROPDOWN MENU</title></head> 
<body><br><br><center> 

<a href="menujsp.jsp">Home Page</a> 

</center> 
</body> 
</html> 

menujsp.jsp :

<%@ taglib prefix="s" uri="/struts-tags" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<style> 

body{ 
background-image:ur(C:\indian-flag-12.gif) no-repeat ; 
font-family:arial;} 
table{font-size:80%;background:black} 
a{color:black;text-decoration:none;font:bold} 
a:hover{color:#606060} 
td.menu{background:lightgrey} 
table.menu 
{ 
font-size:100%; 
position:absolute; 
visibility:hidden; 
} 
</style> 
<script type="text/javascript"> 
function showmenu(elmnt) 
{ 
document.getElementById(elmnt).style.visibility="visible"; 
} 
function hidemenu(elmnt) 
{ 
document.getElementById(elmnt).style.visibility="hidden"; 
} 
</script> 
</head> 

<body> 
<h3>EMPLOYMENT EXCHANGE Test Page</h3> 
<table width="100%"> 
<tr bgcolor="#FG8080"> 
<s:iterator value="menulistlist" var="menulist"> 
<td onmouseover="showmenu(<s:property value="#parent.menuId"/>)" onmouseout="hidemenu(<s:property value="#parent.menuId"/>)"> 
<a href="/default.asp"><s:property value="#parent.menuTitle"/></a><br /> 
<table class="menu" id="<s:property value="#parent.menuId"/>" width="120"> 
<s:iterator value="menulistlist" var="menulist"> 
<tr><td class="menu" id="<s:property value="#parent.menuId"/>"><a href="/html/default.asp"><s:property value="submenuTitle"/></a></td></tr> 
</s:iterator> 
</s:iterator> 

</table> 
</td> 

</body> 

</html> 

plzz help me out...i might have problem in my struts.xml...its not mapping with the action resource my menujsp.jsp code must also be incorrect but thats another issue...first i need to display this jsp whic isn't happening... regards Sachin

View Answers









Related Pages:
STRUTS 2 Could not find action or result
STRUTS 2 Could not find action or result  hiii..i am new to struts 2... on my log: WARNING: Could not find action or result There is no Action...;package name="Basic" extends="struts-default"> <action name="fetch" class
Struts 2 Redirect Action
Struts 2 Redirect Action       In this section, you will get familiar with struts 2 Redirect action and learn to use it in the struts 2 application. Redirect After Post: This post
Chain Action Result Example
in an application by applying Chain Result to a action. A Chain Result is an result type...; extends="struts-default" namespace="/secure"> <action...Chain Action Example Struts2.2.1 provides the feature to chain many actions
Struts 2 RequiredFieldValidator - Struts
What is Struts 2 RequiredFieldValidator? Need an Example or Code  What is Struts 2 RequiredFieldValidator? Need an Example or Code on Field Validation in Struts 2.  Please follow the following instruction:1. index.jsp
Redirect Action Result Example
Redirect Action Result Example The Result uses the ActionMapper of the ActionMapperFactory for redirecting the URL to the specified action. To redirect...;action name="homePage"> <result >/jsp/home.jsp</result>
How to Use Struts 2 token tag - Struts
How to Use Struts 2 token tag  Hi , I want to stop re-submiiting... on my jsp but not able to find what other things i need to write on my action page, or do i need to map anything on my struts.xml file ? I am using struts 2
Struts 2 Login Application
; On viewing the above generated html code you will find that Struts 2... let's develop the action class to handle the login request. In Struts 2...Struts 2 Login Application      
Struts 2 Actions
application frameworks. Struts 2 Action are the important concept in Struts 2... request. About Struts Action Interface In Struts 2 all actions may implement... the Action interface and simple POJO classes can be used as actionStruts 2
jsp to struts 2 action conversion problem - Struts
jsp to struts 2 action conversion problem  i have one jsp page that includes 3 other jsp pages(using RequestDispactcher).how to convert that jsp page to a struts2 action?among that one jsp page is wrritten using jpivot,wct tags
Time Picker in struts 2 - Struts
Time Picker in struts 2  How to create Time Picker in Struts 2 ? ...;</ul>2. struts.xml (Add the following code)<action name="...;head> <title>Struts 2 Time Picker Example!</title>
Dispatcher Result Example
Dispatcher Result Example The Dispatcher Result forwarded the action... dispatcher in result you need to do the following mapping. <action name="...;/struts-tags" %> <html> <head> <title>Chain Result
Struts 2 Training
Struts 2 Training       The Struts 2 Training for developing enterprise applications with Struts 2 framework. Course Code: STRUS-2 Duration: 5.0 day(s) Apply for Struts 2 Training Lectures
Detailed introduction to Struts 2 Architecture
Struts 2 Core components are Action handler, Result Handler and Custom Tags. ... for purchase. In any Struts 2 application *.action is the default mapping... the action very easily.  Expression Language Struts 2 expression language
Introduction to Struts 2 Framework
. Feature Struts 1 Struts 2 Action classes Struts1... with an execute signature can be used as an Struts 2 Action object... ActionForward is class in Struts 1. In Struts 2 action returns
Struts Action Classes
Struts Action Classes  1) Is necessary to create an ActionForm to LookupDispatchAction. If not the program will not executed. 2) What is the beauty of Mapping Dispatch Action
action tag - Struts
action tag  Is possible to add parameters to a struts 2 action tag? And how can I get them in an Action Class. I mean: xx.jsp Thank you
Why Struts 2
core interfaces are HTTP independent. Struts 2 Action classes.... Struts 2 tags are more capable and result oriented. Struts 2 tag markup can... handling per action, if desired. Easy Spring integration - Struts 2
Implementing Actions in Struts 2
Implementing Actions in Struts 2 Package com.opensymphony.xwork2 contains the many Action classes and interface, if you want to make an action class for you...;roseindia" extends="struts-default"> <action name="
servlet action not available - Struts
. Struts Blank Application action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 2 action *.do...servlet action not available  hi i am new to struts and i am
how to forward select query result to jsp page using struts action class
how to forward select query result to jsp page using struts action class  how to forward select query result to jsp page using struts action class
Introduction to Struts 2
to the action class.  Struts 2 actions are Spring friendly and so easy...Introduction to Struts 2       This section provides you a quick introduction to Struts 2 framework
Struts 2 datetimepicker Example
Struts 2 datetimepicker Example       In this section we will show you how to develop datetimepicker in struts 2. Struts 2 uses the dojo toolkit for creating date picker. In Struts 2 its very easy
struts 2 testing
struts 2 testing  can i get an example for struts 2 action class unit test
Struts 2 Login Form Example
Struts 2 Login Form Example tutorial - Learn how to develop Login form in Struts 2 though this video tutorial In this video tutorial I will explain you how you can create Login form in Struts 2 and validate the login action
result problem
result problem  sir,i have written program given below... code: 1)form.jsp: <html> <form name="form" method="post" action...="submit" value="submit"> </form> </html> 2)Data.java: import
Struts 2 Tutorial
2 The new version Struts 2.0 is a combination of the Sturts action framework... 2 Redirect Action In this section, you will get familiar with struts 2 Redirect action and learn to use it in the struts 2 application
Struts 2 - Beganner
Struts 2 - Beganner  Hi ! I am new to Struts2 and I need clarification over Difference between Action Proxy and Action Mapper in struts2 and When both perform their activity?????? Many Thanks Venkateshlu
Sending large data to Action Class error. Struts code - Struts
Sending large data to Action Class error. Struts code  I have a jsp... files and folders sizes to be sent over internet)2. Search files (a good.... Kdiff (to find the differences in two files)4. Keyboard practice tool
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?
How to eliminate error," Could not find the main class: filecopy.FileCopy....) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main... Result: 1 BUILD SUCCESSFUL (total time: 0 seconds
Struts 2 Format Examples
Struts 2 Format Examples       In this section you will learn how to format Date and numbers in Struts 2 Framework. Our Struts 2 Format Examples are very easy to grasp and you will learn these concepts
struts 2 problem with netbeans - Struts
struts 2 problem with netbeans  i made 1 application in struts2 with netbeans but got one errror like There is no Action mapped for namespace / and action name login. The requested resource (There is no Action mapped
Struts 2 Features
Struts 2 Features       The strut-2... to the action class.  Strut 2 actions are Spring friendly and so easy to Spring... of the general features of the current Apache Strut 2 framework are given below. 
session maintain in struts 2
session maintain in struts 2  hi i am new to Struts 2..... in Action class i wrote **HttpSession session = request.getSession(); session.setAttribute("name", name1);** but in jsp class String session_name=(String
Struts 2 Architecture - Detail information on Struts 2 Architecture
Struts 2 Architecture       Struts and webwork has joined together to develop the Struts 2 Framework. Struts 2 Framework... of Struts 2 Framework. Request Lifecycle in Struts 2 applications User Sends request
Struts 2 issue
Struts 2 issue  hi, I have one jsp page and having one hidden field methodName and when we submit request we get value in action class and again i... to same action now problem is when we submit request first time e.g value
Struts 2 Validation (Int Validator)
Struts 2 Validation (Int Validator)       Struts 2 Framework provides in-built validation functions to validate user.... This section discusses all the validation functions available with Struts 2
no action mapped for action - Struts
no action mapped for action  Hi, I am new to struts. I followed...: There is no Action mapped for action name HelloWorld
Struts 2 Radio Button
Struts 2 Radio Button  I have a search functionlaity where i have two radio buttons and I am using Struts2 tag.I want first rado button... result. Can you please help me further how to solve
Could not parse configuration: hibernate.cfg.xml
Could not parse configuration: hibernate.cfg.xml  Hi, I am getting the error- log4j:WARN No appenders could be found for logger.... Exception in thread "main" org.hibernate.HibernateException: Could not parse
XSL Result and its example
="/" extends="struts-default"> <action name="...XSL Result and its example XSLT stands for XSL Transformations. It is the most... or add the attribute from the output file. An Example of XSLT result is given
Struts 2 File Upload
Struts 2 File Upload       In this section you will learn how to write program in Struts 2 to upload the file... in any directory on the server machine. The Struts 2 FileUpload component can
Tiles Result Example in Struts 2.2.1
Tiles Result Example In Struts Tiles is a view layer which allows separate...;package name="default" extends="struts-default"> <result...;org.apache.struts2.views.tiles.TilesResult"/> </result-types> <action name
Java Captcha in Struts 2 Application
; command button. Then our Struts 2 action validates the user input...Java Captcha in Struts 2 Application     ... a captcha Servlet and use in your Struts 2 application. Developing Struts 2 Captcha
struts - Struts
2. wht is the difference b/w the web.xml and struts-config.xml 3. what...-config.xml Action Entry: Difference between Struts-config.xml...struts  hi, what is meant by struts-config.xml and wht are the tags
Diff between Struts1 and struts 2? - Struts
interfaces. While in Struts 2, an Action class implements an Action interface, along... can be used as an Struts 2 Action object. Threading Model Struts 1 Actions...Diff between Struts1 and struts 2?  What are the difference
if we have 2 struts-config files - Struts
if we have 2 struts-config files  if we have declared 2 struts-config.xml files with same action mapping and forward? what will happen. if we have..., No we cannot have 2 struts-config.xml files. In one case we can use 2
Struts 2 Autocompleter,Struts 2 Autocomplete
<action name="autocompleter" class="net.roseindia.autocompleter">...; Create a list in the action class  and populate them with various..." uri="/struts-tags" %> <html>   
Struts Action Chaining
Struts Action Chaining  Struts Action Chaining
Struts 2 imagae set to frame.
Struts 2 imagae set to frame.  I could not set image to frame in stuts 2. Here is the code : 1)index.jsp <%@ taglib uri="/struts-tags" prefix="s" %> <%@taglib uri="/struts-images" prefix="img"%> <img
Struts 2 Session Scope
Struts 2 Session Scope      ...; <struts> <!-- Rose India Struts 2 Tutorials -->..." namespace="/roseindia" extends="struts-default"> <action name

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.