I think you need to change or property name to view or change getter/setter and other stuff. See below in red.
Maya
"G.L. Grobe" wrote:
I'm new to struts and trying to get my index.jsp to show up, but instead I
get the following error:500 Internal Server Error
javax.servlet.jsp.JspException: No getter method available for property View
for bean under name org.apache.struts.taglib.html.BEAN at
org.apache.struts.taglib.html.RadioTag.doStartTag(RadioTag.java, Compiled
Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at
com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at
com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at
com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at
com.evermind.server.http.d3.sw(JAX, Compiled Code) at
com.evermind.server.http.d3.su(JAX, Compiled Code) at
com.evermind.server.http.ef.s1(JAX, Compiled Code) at
com.evermind.server.http.ef.do(JAX, Compiled Code) at
com.evermind.util.f.run(JAX, Compiled Code)Somehow I think the ViewForm bean is not being found as I've got the
properties included, but it seems to be defaulting to another bean. I don't
think I've got to map the properties to the bean, as they map automatically
to the bean in the action form, right?
I've included all my files trying to get a simple example going.
Any help much appreciated.------------- ViewForm.java ---------------------
package com.neuroquest.cais.actions;import org.apache.struts.action.ActionForm;
public class ViewForm extends ActionForm
{
protected String viewName;public String getViewName() {
return viewName;
}public void setViewName(String view) {
this.viewName = view;
}
}
------------- ViewAction.java ---------------------
package com.neuroquest.cais.actions;import javax.servlet.http.*;
import org.apache.struts.action.*;public class ViewAction extends Action
{
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {// turn form instance into custom form bean.
ViewForm viewForm = (ViewForm) form;String viewName = viewForm.getView();
if (viewName.equals("Master View")) {
return mapping.findForward("master");
}
else if (viewName.equals("Details View")) {
return mapping.findForward("details");
}return mapping.findForward("error");
}
}------------- inside my web.xml ---------------------
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>com.neuroquest.cais.resources.cais</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<!--init-param>
<param-name>mapping</param-name><param-value>com.neuroquest.cais.actions.CustomMapping</param-value>
</init-param-->
<load-on-startup>1</load-on-startup>
</servlet><servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>------------- 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"><!-- defines action mappings -->
<struts-config>
<form-beans>
<form-bean name="viewForm"
type="com.neuroquest.cais.actions.ViewForm" />
</form-beans><!--global-forwards type="org.apache.struts.action.ActionForward" >
<forward name="logon" path="/logon.jsp" />
<forward name="success" path="/index.jsp" />
</global-forwards--><action-mappings>
<action path="/view" type="com.neuroquest.cais.actions.ViewAction"
name="viewForm"><forward name="master" path="web/master.jsp" />
<forward name="details" path="web/details.jsp" />
<forward name="error" path="web/error.jsp" /></action>
</action-mappings>
</struts-config>---------------- inside my index.jsp ------------------------
<html:form action="view.do">
<center>
<table border="0" cellspacing="2" cellpadding="0" align="left">
<tr>
<td>
<html:radio property="View" value="Master View">
<a href="#"><bean:message key="main.master" /></a>
</html:radio>
</td>
<td>
<html:radio property="View" value="Details View">
<a href="#"><bean:message key="main.detail" /></a>
</html:radio>
</td>
</tr>
<tr>
<td>
<center>
<html:submit value="View"/>
</center>
</td>
</tr>
</table>
</center></html:form>