Originally posted by Subhradip Podder:
Hi,
Can anybody help me for my problem.i'm using struts+jdk 1.5+Apache 5.
My application flow is login.jsp->success.jsp->epcc8.jsp.
I get success.jsp from login.jsp but when trying to get epcc8.jsp,it will give me error [HTTP Status 404 - /success,The requested resource (/success) is not available.]
This is my struts-config.xml code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans >
<form-bean name="loginForm" type="com.iotde.struts.form.LoginForm" />
<form-bean name="successForm" type="com.iotde.struts.form.SuccessForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
path="/login"
scope="request"
type="com.iotde.struts.action.LoginAction">
<forward name="success" path="/success.jsp" />
<forward name="failure" path="/failure.jsp" />
</action>
<action
attribute="successForm"
input="/success.jsp"
name="successForm"
path="/success"
scope="request"
type="com.iotde.struts.action.SuccessAction">
<forward name="epcc8" path="/epcc8.jsp" />
<forward name="epcc6" path="/epcc6.jsp" />
</action>
</action-mappings>
<message-resources parameter="com.iotde.struts.ApplicationResources" />
</struts-config>
Plese help me.....
HI Merrill Higginson,
plese find bellow my sucess.JSP & successAction
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>success.jsp</title>
<script language="javascript">
function validate()
{
var radio_choice = false;
for (counter = 0; counter < radio_form.project.length; counter++)
{
if (radio_form.project[counter].checked)
radio_choice = true;
}
if (!radio_choice)
{
alert("Please select a letter.")
return (false);
}
return (true);
}
</script>
</head>
<body>
<form method="post" action="/success"
onsubmit="return validate()" name="radio_form">
<CENTER>
<FIELDSET ID="fld1" style="HEIGHT: 200px; WIDTH: 700">
<LEGEND ALIGN="left"><font color="#804000"><b>Projects</b></font></LEGEND>
<table>
<tr>
<td><input type="radio" value="epcc8" name="project">EPCC-8</td>
<tr></tr>
<tr>
<td><input type="radio" value="epcc6" name="project">EPCC-6</td>
</tr>
<tr></tr>
</table>
</FIELDSET>
<table align="center">
<tr>
<td align="center" colspan="2"><input type="submit" value="Submit"></td>
</tr>
</table>
</CENTER>
</html:form>
</body>
</html>
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.iotde.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.iotde.struts.form.SuccessForm;
/**
* MyEclipse Struts
* Creation date: 10-09-2007
*
* XDoclet definition:
* @struts.action path="/success" name="successForm" input="/success.jsp" scope="request" validate="true"
* @struts.action-forward name="epcc8" path="epcc8.jsp"
* @struts.action-forward name="epcc6" path="epcc6.jsp"
*/
public class SuccessAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SuccessForm successForm = (SuccessForm) form;// TODO Auto-generated method stub
if (successForm.getEpcc8().equals("epcc8"))
{
// we are in
return mapping.findForward("epcc8");
} else {
// not allowed
return mapping.findForward("epcc6");
}
}
}
[ October 10, 2007: Message edited by: Subhradip Podder ]