All,
I am a newbie still testing things out to understand struts better.
I have the following structure :
java files in folder /classes.
class files in folder /classes/test.
This is al normal. I have create a simple index.jsp
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
</head>
<body>
<html:form action="/index.do" focus="name">
<table>
<tr>
<td >Name:</td>
<td><html:text property="name"/></td>
</tr>
</table>
<html:submit>ok</html:submit>
</html:form>
</body>
</html>
The url is http://localhost:8080/tests/index.jsp.
This loads perfect. When I hit the submit button he changes the url to
http://localhost:8080/tests/index.do. Up till here I can follow. But then...
Can someone explain me why I need to place my class files also in the
classes folder. Otherwise he complains about a 500 error (didn't produce a
class file). When I found that out, I get another 500 No action instance for
path /index could be created. Apparently this means that my action file does
not extend the action class but it does.
package test;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.commons.beanutils.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public final class insertTestAction extends Action {
public insertTestAction() {}
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
testService service = new testService();
testForm testForm = (testForm) form;
testDTO testDTO = new testDTO();
BeanUtils.copyProperties( testDTO, testForm );
service.insertTest( testDTO );
request.setAttribute("tests",testDTO);
return (mapping.findForward("success"));
}
}
Can someone tell me a bit more about those two things ( like why these
happen, what I can do to avoid the errors). The weirdest thing in fact is
the fact that I need to copy my class files into the classes too, normally
he should look into the test folder...
Greetz,
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/91 - Release Date: 6/09/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]