RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Eelco Hillenius
If you want to use property test, TestController should have that property:

public class TestController extends ThrowawayBean2
{
  private String name;
  private String test;

  public String getname() { return this.name; }
  public void setname(String s) { this.name = s; }

  public String Perform()
  {
test = blah;
return success;
  }

  public String getTest() { return test };
}

or just try c:out value=${model} / to see if your model was set
properly.

Eelco

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
Sent: donderdag 20 februari 2003 12:02
To: '[EMAIL PROTECTED]'
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]



Re: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Catalin Constantin
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]



RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Stephan Visser
Sorry for the typo there It should have read name, not test

I tried to find out the contents of the model just before leaving the
controller it has been set properly, but from the JSP there is nothing...

Stephan.

-Original Message-
From: Eelco Hillenius [mailto:[EMAIL PROTECTED]]
Sent: donderdag 20 februari 2003 12:09
To: [EMAIL PROTECTED]
Subject: RE: [Mav-user] Model doesn't get initialized?


If you want to use property test, TestController should have that property:

public class TestController extends ThrowawayBean2
{
  private String name;
  private String test;

  public String getname() { return this.name; }
  public void setname(String s) { this.name = s; }

  public String Perform()
  {
test = blah;
return success;
  }

  public String getTest() { return test };
}

or just try c:out value=${model} / to see if your model was set
properly.

Eelco

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
Sent: donderdag 20 februari 2003 12:02
To: '[EMAIL PROTECTED]'
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]



RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Eelco Hillenius
Try setting a breakpoint in:

public void go(ViewContext vctx)  throws IOException, ServletException
{
// Should we put the null in the collection?
if (vctx.getModel() != null)
this.setAttribute(vctx);

// Call the aggregated view now handles the JSP rendering now that
// we have set up the bean correctly.
this.forward.go(vctx);
}

class: org.infohazard.maverick.view.DocumentView.

Or... one of the other views if you're using it.

Eelco

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
Sent: donderdag 20 februari 2003 12:28
To: '[EMAIL PROTECTED]'
Subject: RE: [Mav-user] Model doesn't get initialized?


Sorry for the typo there It should have read name, not test

I tried to find out the contents of the model just before leaving the
controller it has been set properly, but from the JSP there is nothing...

Stephan.

-Original Message-
From: Eelco Hillenius [mailto:[EMAIL PROTECTED]]
Sent: donderdag 20 februari 2003 12:09
To: [EMAIL PROTECTED]
Subject: RE: [Mav-user] Model doesn't get initialized?


If you want to use property test, TestController should have that property:

public class TestController extends ThrowawayBean2
{
  private String name;
  private String test;

  public String getname() { return this.name; }
  public void setname(String s) { this.name = s; }

  public String Perform()
  {
test = blah;
return success;
  }

  public String getTest() { return test };
}

or just try c:out value=${model} / to see if your model was set
properly.

Eelco

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
Sent: donderdag 20 februari 2003 12:02
To: '[EMAIL PROTECTED]'
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]



RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Eelco Hillenius
Do you know about the JavaBean spec? This is pretty standard Java stuff...

Eelco


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
Sent: donderdag 20 februari 2003 12:54
To: '[EMAIL PROTECTED]'
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() (wh!!)
- 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]



RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Stephan Visser
So, if I understand you correctly, I should expect the following behaviour:

I have a controller class Foo with a String Name and in a JSP that gets
activated as a view I have to use $model.name (with lowercase name i.s.o.
Name as defined in the class) ??

If the JavaBean specs (which I'm sorry I'm not familiar with) state this
behaviour as standard I't fine by me. Still, I find it pretty confusing...

Stephan.

-Original Message-
From: Vladimir Yusseem [mailto:[EMAIL PROTECTED]]
Sent: donderdag 20 februari 2003 19:49
To: [EMAIL PROTECTED]
Subject: Re: [Mav-user] Model doesn't get initialized?


Also Java seemed to be case sensetive ... :-).

- Original Message -
From: Eelco Hillenius [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 8:53 AM
Subject: RE: [Mav-user] Model doesn't get initialized?


 Do you know about the JavaBean spec? This is pretty standard Java stuff...

 Eelco


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
 Sent: donderdag 20 februari 2003 12:54
 To: '[EMAIL PROTECTED]'
 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() (wh!!)
 - 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]



---
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code

RE: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Schnitzer, Jeff
Yep, that's exactly right.  The JavaBeans spec says that for a property
nameOfBeer, the setter is:

public void setNameOfBeer(String value)

and the getter is:

public String getNameOfBeer()

The case matters.  However, some templating languages (like Velocity)
will compensate for you (JSTL doesn't).

It gets a little weirder.  If you have a boolean value, say lightBeer,
there are two possible getters:

public boolean getLightBeer()
public boolean isLightBeer()

Since it's possible to have both of those methods on a class, one of
them takes precedence over the other (I don't remember which offhand).

Jeff Schnitzer
[EMAIL PROTECTED]

 -Original Message-
 From: Stephan Visser [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 20, 2003 11:05 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [Mav-user] Model doesn't get initialized?
 
 So, if I understand you correctly, I should expect the following
 behaviour:
 
 I have a controller class Foo with a String Name and in a JSP that
gets
 activated as a view I have to use $model.name (with lowercase name
i.s.o.
 Name as defined in the class) ??
 
 If the JavaBean specs (which I'm sorry I'm not familiar with) state
this
 behaviour as standard I't fine by me. Still, I find it pretty
confusing...
 
 Stephan.
 
 -Original Message-
 From: Vladimir Yusseem [mailto:[EMAIL PROTECTED]]
 Sent: donderdag 20 februari 2003 19:49
 To: [EMAIL PROTECTED]
 Subject: Re: [Mav-user] Model doesn't get initialized?
 
 
 Also Java seemed to be case sensetive ... :-).
 
 - Original Message -
 From: Eelco Hillenius [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 8:53 AM
 Subject: RE: [Mav-user] Model doesn't get initialized?
 
 
  Do you know about the JavaBean spec? This is pretty standard Java
 stuff...
 
  Eelco
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of Stephan
Visser
  Sent: donderdag 20 februari 2003 12:54
  To: '[EMAIL PROTECTED]'
  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() (wh!!)
  - 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

Re: [Mav-user] Model doesn't get initialized?

2003-02-20 Thread Eelco Hillenius
Stephan,

To be short, the basic idea for JavaBeans is that if you have a property, it
starts with a (usually) private or protected defined field. In order to
grant access on your 'bean' to the outside world, It should have a 'getter'
and/ or a 'setter'; resp. to allow reading and writing of the field. The
standard says that a getter be of form: 'getXxx' where where the Xxx stands
for the name of the property, the first character (right after 'get') being
capitalised. An exception to 'getXxx' is the reading of a boolean value,
which should have the form 'isXxx'. This is the only exception. The setters
take form: 'setXxx'.

As '$model.name' tries to find property name, JSTL will look for the method
.getName() in your class. If it's not there it will fail (I don't know and
actually don't care about the case when your field is declared public).

Read more about it: ftp://ftp.javasoft.com/docs/beans/beans.101.pdf

Another thing to know about Java are the code conventions:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html

And... before doing anything else, please read at least:
http://java.sun.com/docs/books/tutorial/java/index.html.

Eelco


- Original Message -
From: Stephan Visser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 8:05 PM
Subject: RE: [Mav-user] Model doesn't get initialized?


 So, if I understand you correctly, I should expect the following
behaviour:

 I have a controller class Foo with a String Name and in a JSP that gets
 activated as a view I have to use $model.name (with lowercase name i.s.o.
 Name as defined in the class) ??

 If the JavaBean specs (which I'm sorry I'm not familiar with) state this
 behaviour as standard I't fine by me. Still, I find it pretty confusing...

 Stephan.

 -Original Message-
 From: Vladimir Yusseem [mailto:[EMAIL PROTECTED]]
 Sent: donderdag 20 februari 2003 19:49
 To: [EMAIL PROTECTED]
 Subject: Re: [Mav-user] Model doesn't get initialized?


 Also Java seemed to be case sensetive ... :-).

 - Original Message -
 From: Eelco Hillenius [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 8:53 AM
 Subject: RE: [Mav-user] Model doesn't get initialized?


  Do you know about the JavaBean spec? This is pretty standard Java
stuff...
 
  Eelco
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Visser
  Sent: donderdag 20 februari 2003 12:54
  To: '[EMAIL PROTECTED]'
  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() (wh!!)
  - 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