The model variable will be a member variable in the Page.java - and your
method is in the Page.java - so why can't the method access a member
variable of the class it is in?


On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:

Yes, but if I define the function as you did, then the model variable
won't
be known inside of it.

On 8/4/06, Karthik N <[EMAIL PROTECTED]> wrote:
>
> <tr jwcid="@For" source="ognl:riddleList" value="ognl:model"
element="tr">
>
> each value is stored in a model object in the page.  this is because of
> ognl:model
>
> imagine this being like a for loop
>
> for(i=0; i < 10; i++) {
>
> }
>
> each iteration the model object is like "i"
>
> so when you refer to model in getFoo you are referring to each model
that
> the for loop is iterating through
>
>
>
>
> On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:
> >
> > How do you pass the Model object to your getAnswer function?
> >
> > And while writing the line on the page, how is he going to know which
> > model
> > is that line referring to?
> >
> > On 8/4/06, Karthik N < [EMAIL PROTECTED]> wrote:
> > >
> > > well what i am suggesting is to create a method called getFoo which
is
> > not
> > > in your model.  getFoo is on your page class
> > >
> > > using href=ognl:foo all you are doing is wiring the href to a getFoo
> > > method
> > > on your page
> > >
> > > inside getFoo you create the string as follows:
> > >
> > > public String getAnswer() {
> > >   return new String ( javascript:alert(" ' "+ model.getAnswer
> ().toString()
> > > +
> > > " ' " );
> > > }
> > >
> > > out here model is the current model element of the for loop.
> > >
> > >
> > > On 8/4/06, Rui Pacheco < [EMAIL PROTECTED]> wrote:
> > > >
> > > > I don't think I can create a getAnswer method, as my answer
variable
> > is
> > > > inside an object through which I am iterating in a @For loop.
> > > >
> > > > The problem with trial and error is that I don't know where to
> begin.
> > > >
> > > > On 8/4/06, Karthik N <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > please try this:
> > > > >
> > > > > href=ognl:answer
> > > > >
> > > > > and in
> > > > >
> > > > > public String getAnswer() {
> > > > >    return new String ( javascript:alert(" ' "+ ognl:
> > > > model.answer.toString
> > > > > ()
> > > > > + " ' " );
> > > > > }
> > > > >
> > > > > i recommend you use view source to see the generated HTML and
> tweak
> > > > things
> > > > > here and there - with a little trial and error you'll get it
right
> > in
> > > 5
> > > > > attempts!! :-)
> > > > >
> > > > > On 8/4/06, Rui Pacheco < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > I changed my code to this:
> > > > > > <a jwcid="@GenericLink" href='javascript:alert("ognl:
> model.answer
> > > ")'>
> > > > > >                 <img height=40 alt="" src="imagens/IAdv.gif"
> > > > width="63"
> > > > > > border="0">
> > > > > >             </a>
> > > > > >
> > > > > > But now I get an alert saying "ognl:model.answer".
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 8/4/06, Karthik N < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > each value of your For loop is stored in the ognl:model
> > > > > > >
> > > > > > > so for your href you need to access the model object to
create
> > the
> > > > > alert
> > > > > > > javascript.
> > > > > > >
> > > > > > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > Jesse, how can I access the model in your example? I tried
> > your
> > > > > > snippet
> > > > > > > > and
> > > > > > > > it generates an exception.
> > > > > > > >
> > > > > > > > On 8/4/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
> > > > > > > > >
> > > > > > > > > The @Any component is great for this. You can attach a
> > > > > jwcid="@Any"
> > > > > > to
> > > > > > > > > automatically "decorate" existing random html elements
> > without
> > > > > > > > necessarily
> > > > > > > > > doing anything specific to one component.
> > > > > > > > >
> > > > > > > > > In your case (as previously suggested), you could add
the
> > > > > > jwcid="@Any"
> > > > > > > > and
> > > > > > > > > then do something like:
> > > > > > > > >
> > > > > > > > > href="ognl:'alert('+myModel.getId()+')"
> > > > > > > > >
> > > > > > > > > P.S. You don't need to put javascript: in front of
> > javascript
> > > > > > > statements
> > > > > > > > > on
> > > > > > > > > element nodes anymore.
> > > > > > > > >
> > > > > > > > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED] > wrote:
> > > > > > > > > >
> > > > > > > > > > Sorry, I guess an example is the best way to show my
> > > problem:
> > > > > > > > > > <tr jwcid="@For" source="ognl:riddleList"
> > value="ognl:model"
> > > > > > > > > element="tr">
> > > > > > > > > > <td class="texto2"><span jwcid="@Insert" value="ognl:
> > > > > model.riddle
> > > > > > > > > "/></td>
> > > > > > > > > >     <td width="65">
> > > > > > > > > >         <a href=javascript:alert(1)>
> > > > > > > > > >             <img height=40 alt=""
src="imagens/IAdv.gif"
> > > > > width=63
> > > > > > > > > > border=0>
> > > > > > > > > >         </a>
> > > > > > > > > >         <a href="">&nbsp;</a>
> > > > > > > > > >     </td>
> > > > > > > > > > </tr>
> > > > > > > > > >
> > > > > > > > > > I want my want to be generated dinamically. The number
> > comes
> > > > > from
> > > > > > > the
> > > > > > > > > > database, inside an object called Model. How can I
place
> > it
> > > > > there?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 8/4/06, Jesse Kuhnert < [EMAIL PROTECTED]> wrote:
> > > > > > > > > > >
> > > > > > > > > > > Yes, also don't forget the power of "this" and how
it
> > > > changes
> > > > > > > > > depending
> > > > > > > > > > on
> > > > > > > > > > > context. I'd have to see your code but it's quite
> > possible
> > > > > that
> > > > > > > you
> > > > > > > > > can
> > > > > > > > > > > navigate from "this" to any dom node in your browser
> if
> > > > "this"
> > > > > > > > points
> > > > > > > > > to
> > > > > > > > > > a
> > > > > > > > > > > dom node.
> > > > > > > > > > >
> > > > > > > > > > > On 8/4/06, Karthik N <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > i guess i'm not too clear what you want to
achieve:
> > > > > > > > > > > >
> > > > > > > > > > > > i suppose you can have an informal parameter
> > > > > > > > > onclick=ognl:clickAction
> > > > > > > > > > > and
> > > > > > > > > > > > then create the javascript in the getClickAction
> which
> > > > forms
> > > > > > the
> > > > > > > > > > string
> > > > > > > > > > > > based on the current ID
> > > > > > > > > > > >
> > > > > > > > > > > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]>
> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi all
> > > > > > > > > > > > >
> > > > > > > > > > > > > I need to pass a parameter to a JS alert(). This
> is
> > > > > repeated
> > > > > > > in
> > > > > > > > > > > several
> > > > > > > > > > > > > rows
> > > > > > > > > > > > > of a table created with a @For component, and
the
> > > > > parameter
> > > > > > is
> > > > > > > > the
> > > > > > > > > > id
> > > > > > > > > > > of
> > > > > > > > > > > > > the
> > > > > > > > > > > > > elements of the current row. Passing <span> will
> of
> > > > course
> > > > > > > break
> > > > > > > > > the
> > > > > > > > > > > JS
> > > > > > > > > > > > > function and the HTML its in.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Can anyone please sugest a different solution?
> > > > > > > > > > > > >
> > > > > > > > > > > > > --
> > > > > > > > > > > > > Cumprimentos,
> > > > > > > > > > > > > Rui Pacheco
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > > Thanks, Karthik
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > Jesse Kuhnert
> > > > > > > > > > > Tacos/Tapestry, team member/developer
> > > > > > > > > > >
> > > > > > > > > > > Open source based consulting work centered around
> > > > > > > > > > > dojo/tapestry/tacos/hivemind.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Cumprimentos,
> > > > > > > > > > Rui Pacheco
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Jesse Kuhnert
> > > > > > > > > Tacos/Tapestry, team member/developer
> > > > > > > > >
> > > > > > > > > Open source based consulting work centered around
> > > > > > > > > dojo/tapestry/tacos/hivemind.
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Cumprimentos,
> > > > > > > > Rui Pacheco
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Thanks, Karthik
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Cumprimentos,
> > > > > > Rui Pacheco
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Thanks, Karthik
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Cumprimentos,
> > > > Rui Pacheco
> > > >
> > > >
> > >
> > >
> > > --
> > > Thanks, Karthik
> > >
> > >
> >
> >
> > --
> > Cumprimentos,
> > Rui Pacheco
> >
> >
>
>
> --
> Thanks, Karthik
>
>


--
Cumprimentos,
Rui Pacheco




--
Thanks, Karthik

Reply via email to