package src.ginsu.strutsApp;
and in your struts-config.xml you are trying to load
type="ginsu.strutsApp.AddFileAction"
ie. package ginsu.strutsApp
Dan Tarkenton wrote:
Hello all. I apologize for the size of this message,
but I thought it necessary to include some of my
source.
I am trying to do a very basic thing here. I trying to pass form data to an Action object. However i am getting the following tomcat error, when I submit from http://localhost:8080/ginsu/test/addFile.jsp :
*************** Begin My Error ***********************
HTTP Status 500 - No action instance for path /addFile could be created
type Status report
message No action instance for path /addFile could be created
description The server encountered an internal error (No action instance for path /addFile could be created) that prevented it from fulfilling this request.
*********** End My error **************************
I have consulted both the Struts in Action book as well as the struts-example web app. I just don't see where my problem resides. So I thought it best to consult you more experienced struts users. My first guess is that I have configured struts-config.xml incorrectly.
I will first list my struts-config.xml file (which is
where I _think_ my error may be), my addFile.jsp (a
simple form), my AddFileForm (struts FormBean), and my
AddFileAction class (Struts Action).
I hope you guys can see something obvious. Here's hoping.
********* struts-config.xml *************** <?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts
Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions =================================== -->
<form-beans>
<form-bean name="contentForm"
type="ginsu.strutsApp.ContentForm" />
<form-bean name="addFileForm"
type="ginsu.strutsApp.AddFileForm" />
</form-beans>
<!-- ========== Global Forward Definitions
============================== -->
<global-forwards> <!-- every Action class will forward to XSLServlet, the View component of ginsu --> <forward name="xslServlet" path="/XSLServlet" /> </global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<action path="/test" type="ginsu.strutsApp.ContentAction"
name="contentForm"> </action>
<action path="/addFile" type="ginsu.strutsApp.AddFileAction"
name="addFileForm"
input="/test/addFile.jsp"> </action> <action path="/admin/addFormBean"
type="org.apache.struts.actions.AddFormBeanAction"/>
<action path="/admin/addForward"
type="org.apache.struts.actions.AddForwardAction"/>
<action path="/admin/addMapping"
type="org.apache.struts.actions.AddMappingAction"/>
<action path="/admin/reload"
type="org.apache.struts.actions.ReloadAction"/>
<action path="/admin/removeFormBean"
type="org.apache.struts.actions.RemoveFormBeanAction"/>
<action path="/admin/removeForward"
type="org.apache.struts.actions.RemoveForwardAction"/>
<action path="/admin/removeMapping"
type="org.apache.struts.actions.RemoveMappingAction"/>
</action-mappings>
</struts-config>
******* end struts-config.xml *******************
And now my jsp form:
******* Begin addFile.jsp ***********************
<html> <head>
<title>Add an XML File to Slide</title>
</head> <body>
<form method="POST" action="/ginsu/addFile.do"> <table border="0" width="100%">
<tr>
<th align="right">
Filename:
</th>
<td align="left">
<input type="text" name="filename" value="">
</td>
</tr>
<tr> <td align="right"> <input type="submit" name="submit" value="Submit filename"> </td> <td align="left"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form>
</body> </html>
****** End addFile.jsp ************************
My FormBean:
****** Begin AddFileForm.java *****************
package src.ginsu.strutsApp;
import org.apache.struts.action.*;
public class AddFileForm extends ActionForm {
protected String filename = null;
public String getFilename() {
return this.filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
}
****** End AddFileForm.java ********************
And finally, My AddFileAction class:
****** Begin AddFileAction.java ****************
package src.ginsu.strutsApp;
import ginsu.content.adapter.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.xml.transform.dom.DOMSource;
/**
*
* @author tarkentond
*/
public class AddFileAction extends Action {
public ActionForward perform (ActionMapping
mapping,
ActionForm form,
HttpServletRequest
request,
HttpServletResponse response) {
AddFileForm addForm = (AddFileForm)form;
String fullPath = addForm.getFilename();
StringTokenizer tokenizer = new
StringTokenizer(fullPath, "/");
Vector temp = new Vector();
while (tokenizer.hasMoreTokens()) {
temp.addElement(tokenizer.nextToken());
}
String slideFileName =
(String)temp.lastElement();
String slideUri = "/files/" + slideFileName;
try {
ContentAdapterImpl adapter = new
ContentAdapterImpl();
adapter.initDomain("ginsunamespace", "root");
adapter.createFile(new
FileInputStream(fullPath), slideUri);
DOMSource dom =
adapter.retrieveXml(slideUri);
request.setAttribute("dom", dom);
} catch (Exception e) {
request.setAttribute("exception",
e.toString()); }
return mapping.findForward("xslServlet");
}
}
******* End AddFileAction.java ********************
Thanks in advance for your time and effort looking
over this long email.
-Dan
__________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]