Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NO Getter method

 
Abebe Belew
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running a simple Struts application and am getting this error message
No getter method for property mrn of bean org.apache.struts.taglib.html.BEAN
Here are my files. I have remoed the opening and closing tags. Please help!

JSP
=====

<jsp:useBean id="result" class="app.RegisterForm" scope="request"/>

<HTML>

<html:errors/>
<html:form action="/register">
<p> Connection to DB2 </p>
Enter MRN Please: <html:text property="mrn"/>
<html:Submit/>
</html:form>


Form
=====

package app;

import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;

public class RegisterForm extends ActionForm{

protected String mrn;


public String getMrn(){
return (this.mrn);
}

public void setMrn(String mrn){
this.mrn=mrn;
}


}

Action
======
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
import java.lang.*;
import java.sql.*;

public class RegisterAction extends Action{

private String selectStr ;
protected String mrn;

public ActionForward execute (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{


RegisterForm c = (RegisterForm) form;
mrn = c.getMrn();

// String mrn = ((RegisterForm) form).getMrn();


HttpSession session = request.getSession(true);
session.putValue("registerSess", c);

selectStr = c.queryExecute();

return mapping.findForward("success");

}
}
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your action-mapping look like in struts-config?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic