| Author |
Struts problem
|
Rick Charles
Greenhorn
Joined: Jul 27, 2006
Posts: 25
|
|
Hi Guyz.... I use a abstract class in which i extend the action form just for overriding the validate method namely import org.apache.struts.action.*; import javax.servlet.http.*; public abstract class Base_Form extends ActionForm{ public abstract ActionErrors SSValidate(ActionMapping mapping,HttpServletRequest request); public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){ return SSValidate(mapping,request); } } And My Action Form is import org.apache.struts.action.*; import javax.servlet.http.*; public class Logger_Form extends Base_Form{ private String textBox1 = ""; private String textBox2 = ""; public ActionErrors SSValidate(ActionMapping mapping,HttpServletRequest request){ ActionErrors errors = new ActionErrors(); if(textBox1.trim().equalsIgnoreCase("")){ errors.add("textbox1",new ActionError("error.textbox1")); return errors; } if(textBox2.trim().equalsIgnoreCase("")){ errors.add("textbox2",new ActionError("error.textbox2")); return errors; } return null; } /** * Getter for property textBox1. * @return Value of property textBox1. */ public java.lang.String getTextBox1() { return textBox1; } /** * Setter for property textBox1. * @param textBox1 New value of property textBox1. */ public void setTextBox1(java.lang.String textBox1) { this.textBox1 = textBox1; } /** * Getter for property textBox2. * @return Value of property textBox2. */ public java.lang.String getTextBox2() { return textBox2; } /** * Setter for property textBox2. * @param textBox2 New value of property textBox2. */ public void setTextBox2(java.lang.String textBox2) { this.textBox2 = textBox2; } } when i set the value of the validate attribute of struts-config to false am getting a error No action instance for path /.... could be created what is happening here?
|
 |
Brent Sterling
Ranch Hand
Joined: Feb 08, 2006
Posts: 948
|
|
I am not sure where or if the form code that you included fits onto this error message. When do you get this message? Maybe posting your <html:form> code or the entries from your struts-config file would shed some light on the problem. - Brent
|
 |
Rick Charles
Greenhorn
Joined: Jul 27, 2006
Posts: 25
|
|
<html:form action="LoggerTest"> <table> <html:errors/> <tr> <td> <html:text property="textBox1"/> </td> <td> <html:text property="textBox2"/> </td> </tr> <tr> <td colspan='2' align='center'> <html:submit/> </td> </tr> </table> </html:form> And one more clarification <html:select property="selectedValue"> <html ptions collection="collectedValues" labelProperty="selectedLabel" property="selectedValue"/> </html:select> the "collectedValues" which i mentioned above is a session variable which is populated in action.when i do that i get a error "cannot find bean under name collectedValues" if i cut that from my jsp and refresh the page i get the two textboxes and if i supply some values to the textboxes and then paste that in my jsp ... am getting the combo populated.... is there anyway that i validate combo in ActionForm
|
 |
Brent Sterling
Ranch Hand
Joined: Feb 08, 2006
Posts: 948
|
|
Rick: I was out of town for a bit and did not catch your response. Are you still working on this issue? I am a bit fuzzy on what your current errors are. I take it that you are pretty new to Struts. BTW, I like to use the html ptionsCollection tag instead of the html ptions tag...mostly because the attributes are more consistent with the other html tags. - Brent
|
 |
 |
|
|
subject: Struts problem
|
|
|