wood burning stoves 2.0*
The moose likes Struts and the fly likes RequestProcessor not able to find the Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "RequestProcessor not able to find the Action class" Watch "RequestProcessor not able to find the Action class" New topic
Author

RequestProcessor not able to find the Action class

Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
I have created a Sample.jsp in jsp folder (At the same level as WEB-INF). I have a populate() javascript funtion which is making an AJAX call to the Action Class named PopulateSampleAction. For making the AJAX call I have created a url string as
var url="populateSample.do?

In strutsConfig.xml I'm also doing the following mapping
<action path="/populateSample" type="PopulateSampleAction">

When I run the JSP the control is not reaching the PopulateSampleAction class, and I'm receiving the following message at the console:

[12/5/06 18:01:40:651 IST] 5095b529 RequestProces E org.apache.struts.action.RequestProcessor Invalid path /jsp/populateSample was requested


This problem is only comming when I have put the sample.jsp file in the jsp folder, if I remove the file from that folder and put it in open along with WEB-INF, the control is reaching the PopulateSampleAction class and everything is working fine from there on.

I'm totally confused as to why the requestprocessor is not picking up the <action path="/populateSample" type="PopulateSampleAction"> from the struts config file and why it is taking the /jsp/ folder into consideration.

Is there any configuration setting that we need to do for adding the folders to keep the jsp's segregated?
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
My guess is that the problem is related to this: "var url="populateSample.do". I am not sure how you are using this variable in your code. It appears that is that it is being interpreted as being relative to the current page (since it does not start with a /) so that is where the jsp part of the URL is coming in.

- Brent
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Hi Brent,
The var url is used as a URL string that is used to make an AJAX call in the javascript funtion. Please have a look a the javascript code snippet below:

--------------------------------------------------------
function populate(){
var selectedValue=document.getElementById("id1").value
if(window.ActiveXObject){
var url="populateSample.do?selectedValue="+selectedValue;
req= new ActiveXObject("Microsoft.XMLHTTP");
req.open("GET",url,true);
req.onreadystatechange = getValue;
req.send();
}
}
--------------------------------------------------------

The above javascript call is made on the following jsp tag:

<TD>sample1: <html:select property="id1" on change="populate()">
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Any updates on this issue?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I believe Brent gave you the correct answer. If you want the URL to be valid regarless of your current context, you must specify url="<%=request.getContextPath()%>/populateSample.do".


Merrill
Consultant, Sima Solutions
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Sorry...some times my boss expects me to actually get some work done and I don't get much time to drop in on the forum. ;-) Merrill's response looks like what I was thinking.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestProcessor not able to find the Action class