this.setName(this.getCtx().getRequest().getParameter("first_name")); this line is required only if you want to use $model.name in your JSP file and you don't have any setter and getter for firs_name. to avoid this just add another private variable to your class private String first_name; and the appropriate setter and getter public void setFirst_name(String s); public String getFirst_name(); and then, you can use in your .jsp file $model.first_name
so the thing is that if there are any GET or POST variables sent to your script if the maverick servlet finds the setter in your class it will automaticaly set it ! good luck ! Catalin ----- Original Message ----- From: Stephan Visser To: '[EMAIL PROTECTED]' Sent: Thursday, February 20, 2003 1:53 PM Subject: RE: [Mav-user] Model doesn't get initialized? Ok.. I got a bit further now (it actually works) but I am still confused... I did the following to my example-code: - Renamed Perform() to perform() (whoooo!!) - Added to the perform method: this.setName(this.getCtx().getRequest().getParameter("first_name")); Now, I discovered that in my class I actually have a private String Name (mind the capital N!) >From the JSP I can get to the value through <c:out value="${model.name}"/> and NOT through <c:out value="${model.Name}"/>..... is that behaviour I should expect? Anyway, it works now and for the time being I'll just keep all my fields lowercase to not get mixed up with the $model references from the JSP's.... Stephan. -----Original Message----- From: Catalin Constantin [mailto:[EMAIL PROTECTED]] Sent: donderdag 20 februari 2003 12:09 To: [EMAIL PROTECTED] Subject: Re: [Mav-user] Model doesn't get initialized? try <c:out value="${model.name}" /> in the .jsp file Catalin ----- Original Message ----- From: Stephan Visser To: '[EMAIL PROTECTED]' Sent: Thursday, February 20, 2003 1:02 PM Subject: [Mav-user] Model doesn't get initialized? Hi there! I am trying to create a simple example application, using the friendbook as an example. The framework seems to work fine, including LOG4J. I do have a lot of problems when I try to get a controller to work. I have something like this: package com.maverick.controllers; import org.infohazard.maverick.ctl.ThrowawayBean2; public class TestController extends ThrowawayBean2 { private String name; public String getname() { return this.name; } public void setname(String s) { this.name = s; } public String Perform() { return "success"; } } In the maverick.xml I have something like this: <command name="submitname"> <controller class="com.maverick.controllers.TestController" /> <view name="success" path="testform.jsp"/> </command> In my testform.jsp I try to read the value from the model like so: <c:out value="${model.test}" /> ...and now for the weird part (and also my question).... NOTHING comes out of the model! Am I overseeing something or doing something wrong?? I spent an entire evening trying to figure out how to get this to work, no success. I even tried to explicitly fill the model in the controller using the setModel method.... nothing happens.... I have absolutely no clue ... can anybody help me? Thanks in advance! Stephan. ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge [INVALID FOOTER] ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge [INVALID FOOTER] ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge [INVALID FOOTER] ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge [INVALID FOOTER]