You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Sunil Tiwari <su...@tatainfotech.com> on 2005/04/21 14:11:31 UTC

regarding

Hi,

How to navigate to some other page by just selecting one value from a drop down menu in JSF?
I mean you shd nt use the submit or link.
suppose there are 3 values in the drop down.
Now, depending on whatever you select , it should go to different page.
say, if i select first value, it shd go to first.jsp.
if i select second value then it shd go to second.jsp and so on.

I am able to do this by using submit button but i am not able to do this without the button.

the moment u select some value from the dropdown , some other jsp page shd come up depending on the value selected by the user.

I am using JSF on WebSphere.

Plz help guys.

Thanx in Advance
Sunil

Tree2: ActionListener + action-Method in a commandLink is still not working

Posted by Hendrik Neumann <ma...@hendrik-neumann.de>.
Hi everybody,

I still have the problem, that using both, an ActionListener- and an 
ActionMethod-Attribut in a commandLink is not working.

Clicking on the following link just calls the action-method, but NOT the 
action-listener.

<h:commandLink  styleClass="#{t.nodeSelected ? 'documentSelected' : 
'document'}" action="#{currentUser.userSelectsCategoryOrArticle}" 
immediate="true" actionListener="#{t.setNodeSelected}"  > [...]

I'm using this command link within the tree2-component to navigate through 
results of the latest research accomplish by our research center. Whenever a 
scientist clicks on an item in the tree the action-method should call a new 
site and the action-listener should set the current node in "nodeSelected = 
true"-mode which changes the CSS-Style for this element, but it is simply not 
working... the action-methods works fine, but the action-listener seems to be 
dead...

What  am I doing wrong? Is it a bug (a related bug-report was closed a few 
weeks ago)? Is there a work around?

P.S: I'm using tomcat5 and the latest MyFaces-release, OS is SuSE- and 
Gentoo-Linux, everything is up to date. Should I create a new bug-report?

Greetings,
Hendrik

research center 459, Ruhr-University of Bochum

Re: DataTable and binding value?

Posted by Lking <lk...@yahoo.com.br>.
Thanks Martin!


----- Original Message ----- 
From: "Martin Marinschek" <ma...@gmail.com>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Friday, May 06, 2005 4:08 AM
Subject: Re: DataTable and binding value?


what you need to do is call "setValueBinding" for the expressions and
prepare a new ValueBinding for that.

like in this sample code:

setValueBinding(new ValueBindingImpl(
                FacesContext.getCurrentInstance().getApplication(),
                "#{bean.array}");

regards,

Martin

On 5/5/05, Lking <lk...@yahoo.com.br> wrote:
> Hello all
>
>     I'm trying DataTable and it worked ok if I set "value" and "var" in my
> jsf page. But trying to set both in my class having DataTable binded 
> didn't
> work. Can anybody help me?
>
> it worked this way...
>
> page...
> value="#{bean.array}"
> var="myBean"
>
> <h:outputText value="#{myBean.id}"..
>
> but it didn't this way...
>
> dataTable.setValue("#{bean.array}");
> dataTable.setVar("myBean");
>
> outputText.setValue("#{myBean.id}");
>
> Thanks.,
>
> 



Layout and coordinate

Posted by Lking <lk...@yahoo.com.br>.
I was wondering if any of the panels allow me to add components and set 
coordinate "x" and "y", just as I can do with swing's layout.

Thanks. 



Re: DataTable and binding value?

Posted by Martin Marinschek <ma...@gmail.com>.
what you need to do is call "setValueBinding" for the expressions and
prepare a new ValueBinding for that.

like in this sample code:

setValueBinding(new ValueBindingImpl(
                FacesContext.getCurrentInstance().getApplication(),
                "#{bean.array}");

regards,

Martin

On 5/5/05, Lking <lk...@yahoo.com.br> wrote:
> Hello all
> 
>     I'm trying DataTable and it worked ok if I set "value" and "var" in my
> jsf page. But trying to set both in my class having DataTable binded didn't
> work. Can anybody help me?
> 
> it worked this way...
> 
> page...
> value="#{bean.array}"
> var="myBean"
> 
> <h:outputText value="#{myBean.id}"..
> 
> but it didn't this way...
> 
> dataTable.setValue("#{bean.array}");
> dataTable.setVar("myBean");
> 
> outputText.setValue("#{myBean.id}");
> 
> Thanks.,
> 
>

DataTable and binding value?

Posted by Lking <lk...@yahoo.com.br>.
Hello all


    I'm trying DataTable and it worked ok if I set "value" and "var" in my 
jsf page. But trying to set both in my class having DataTable binded didn't 
work. Can anybody help me?


it worked this way...

page...
value="#{bean.array}"
var="myBean"

<h:outputText value="#{myBean.id}"..


but it didn't this way...

dataTable.setValue("#{bean.array}");
dataTable.setVar("myBean");

outputText.setValue("#{myBean.id}");


Thanks.,



Re: regarding

Posted by Slawek <ss...@o2.pl>.
coded in opera M2;) so code is not checked, but should work;)
or at least demonstrate the idea "1":

===========view============

<script language="javascript">
function comboChanged(){
  	document.getElementById("f:hiddenButton").click();
}
</script>

<h: form id="f">
<h:commandbutton value="hidden button" action="#{bean.action}"
style="display:none" id="hiddenButton"/>

<h:selectonemenu value=#{bean.selectedComboValue}
  onchange="comboChanged()">
  	<f:selectItems value="#{bean.comboValues}"/>
  </h:selectonemenu />
  </h:form>
==========model===========
public class bean{
  	private String selectedComboValue;
  	private SelectItem[] comboValues;

  	public string action(){
  		//check value of selectedComboValue, do sth, return string depended on
on that value
  	}

  	//getters & setters
}

>> Hi,
>>
>> I am strugling with the same issue, and am of course pleased to see
>> that it can be solved :-)
>>
>> My only problem is that I can't follow the idea schetched here, are
>> you able to provide a code example?
>>
>> In my case I also need to suply an <f:param> for the page I am
>> navigating to, but I suspect I will be able to resolve that in the
>> action of the hidden button?
>>
>> Thanks in advance
>> madsph
>>
>>
>> On 4/21/05, Heath Borders <he...@gmail.com> wrote:
>>> We are doing concept _1_, and its working well for us.
>>>
>>>
>>>
>>> On 4/21/05, Slawek <ss...@o2.pl> wrote:
>>> > i have 2 concepts:
>>> >
>>> > //-----1-------------------
>>> > u can put invisivle command button:
>>> > to do this jus add style paramter with value
>>> >   dispalay:none
>>> > or
>>> >   visibility:hidden
>>> > (i cant remeber which is better)
>>> > action of that button can determine selected value...
>>> >
>>> > u can add onchange="comboboxChanged()" parmaterer to your combobox.
>>> > comboboxChanged() is javascript function that "clicks" your invisible
>>> > button.
>>> > action binded to that button can determine value of combox and for 
>>> example
>>> > return somme string that will be maped to view...
>>> >
>>> > //-----2-------------------------
>>> > u can put three (or whatever u need) invisble buttons. each of them 
>>> has
>>> > action that finally leads to desired view.
>>> > that time your JS function must determine selection and "click" one 
>>> of
>>> > invisble buttones (depending on selection)
>>> > //============================
>>> >
>>> > summary:
>>> > first method check selection on server but secod do that on client
>>> > problem:
>>> > when user drop down list and choose the _same_ value than nothing
>>> > happends:/
>>> > u cant add onclick attrib cause it will be fired wher user drop down 
>>> list
>>> > (before choose value)-what a shyt;)
>>> >
>>> > choose whatever matches your philosophy or sth;)
>>> >
>>> > cheers
>>> >
>>> > Sławek
>>> >
>>> > > Hi,
>>> > >
>>> > > How to navigate to some other page by just selecting one value 
>>> from a
>>> > > drop down menu in JSF?
>>> > > I mean you shd nt use the submit or link.
>>> > > suppose there are 3 values in the drop down.
>>> > > Now, depending on whatever you select , it should go to different 
>>> page.
>>> > > say, if i select first value, it shd go to first.jsp.
>>> > > if i select second value then it shd go to second.jsp and so on.
>>> > >
>>> > > I am able to do this by using submit button but i am not able to 
>>> do this
>>> > > without the button.
>>> > >
>>> > > the moment u select some value from the dropdown , some other jsp 
>>> page
>>> > > shd come up depending on the value selected by the user.
>>> > >
>>> > > I am using JSF on WebSphere.
>>> > >
>>> > > Plz help guys.
>>> > >
>>> > > Thanx in Advance
>>> > > Sunil
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> -Heath Borders-Wing
>>>  hborders@mail.win.org
>



Re: regarding

Posted by Mads Henderson <ma...@gmail.com>.
Hi,

I am strugling with the same issue, and am of course pleased to see
that it can be solved :-)

My only problem is that I can't follow the idea schetched here, are
you able to provide a code example?

In my case I also need to suply an <f:param> for the page I am
navigating to, but I suspect I will be able to resolve that in the
action of the hidden button?

Thanks in advance
madsph


On 4/21/05, Heath Borders <he...@gmail.com> wrote:
> We are doing concept _1_, and its working well for us.
> 
> 
>  
> On 4/21/05, Slawek <ss...@o2.pl> wrote: 
> > i have 2 concepts:
> > 
> > //-----1-------------------
> > u can put invisivle command button:
> > to do this jus add style paramter with value 
> >   dispalay:none
> > or
> >   visibility:hidden
> > (i cant remeber which is better)
> > action of that button can determine selected value...
> > 
> > u can add onchange="comboboxChanged()" parmaterer to your combobox. 
> > comboboxChanged() is javascript function that "clicks" your invisible
> > button.
> > action binded to that button can determine value of combox and for example
> > return somme string that will be maped to view... 
> > 
> > //-----2-------------------------
> > u can put three (or whatever u need) invisble buttons. each of them has
> > action that finally leads to desired view.
> > that time your JS function must determine selection and "click" one of 
> > invisble buttones (depending on selection)
> > //============================
> > 
> > summary:
> > first method check selection on server but secod do that on client
> > problem:
> > when user drop down list and choose the _same_ value than nothing 
> > happends:/
> > u cant add onclick attrib cause it will be fired wher user drop down list
> > (before choose value)-what a shyt;)
> > 
> > choose whatever matches your philosophy or sth;)
> > 
> > cheers
> > 
> > Sławek
> > 
> > > Hi,
> > >
> > > How to navigate to some other page by just selecting one value from a
> > > drop down menu in JSF?
> > > I mean you shd nt use the submit or link.
> > > suppose there are 3 values in the drop down. 
> > > Now, depending on whatever you select , it should go to different page.
> > > say, if i select first value, it shd go to first.jsp.
> > > if i select second value then it shd go to second.jsp and so on.
> > > 
> > > I am able to do this by using submit button but i am not able to do this
> > > without the button.
> > >
> > > the moment u select some value from the dropdown , some other jsp page
> > > shd come up depending on the value selected by the user. 
> > >
> > > I am using JSF on WebSphere.
> > >
> > > Plz help guys.
> > >
> > > Thanx in Advance
> > > Sunil
> > 
> > 
> 
> 
> 
> -- 
> -Heath Borders-Wing
>  hborders@mail.win.org

Re: regarding

Posted by Heath Borders <he...@gmail.com>.
We are doing concept _1_, and its working well for us.

On 4/21/05, Slawek <ss...@o2.pl> wrote: 
> 
> i have 2 concepts:
> 
> //-----1-------------------
> u can put invisivle command button:
> to do this jus add style paramter with value
> dispalay:none
> or
> visibility:hidden
> (i cant remeber which is better)
> action of that button can determine selected value...
> 
> u can add onchange="comboboxChanged()" parmaterer to your combobox.
> comboboxChanged() is javascript function that "clicks" your invisible
> button.
> action binded to that button can determine value of combox and for example
> return somme string that will be maped to view...
> 
> //-----2-------------------------
> u can put three (or whatever u need) invisble buttons. each of them has
> action that finally leads to desired view.
> that time your JS function must determine selection and "click" one of
> invisble buttones (depending on selection)
> //============================
> 
> summary:
> first method check selection on server but secod do that on client
> problem:
> when user drop down list and choose the _same_ value than nothing
> happends:/
> u cant add onclick attrib cause it will be fired wher user drop down list
> (before choose value)-what a shyt;)
> 
> choose whatever matches your philosophy or sth;)
> 
> cheers
> 
> Sławek
> 
> > Hi,
> >
> > How to navigate to some other page by just selecting one value from a
> > drop down menu in JSF?
> > I mean you shd nt use the submit or link.
> > suppose there are 3 values in the drop down.
> > Now, depending on whatever you select , it should go to different page.
> > say, if i select first value, it shd go to first.jsp.
> > if i select second value then it shd go to second.jsp and so on.
> >
> > I am able to do this by using submit button but i am not able to do this
> > without the button.
> >
> > the moment u select some value from the dropdown , some other jsp page
> > shd come up depending on the value selected by the user.
> >
> > I am using JSF on WebSphere.
> >
> > Plz help guys.
> >
> > Thanx in Advance
> > Sunil
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org

Re: regarding

Posted by Sunil Tiwari <su...@tatainfotech.com>.
Hi Slawek,

Thanx a lot for ur prompt reply.
I implemented the first way and its working fine.

thanx again..
Regards,
Sunil

----- Original Message ----- 
From: "Slawek" <ss...@o2.pl>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Thursday, April 21, 2005 11:52 PM
Subject: Re: regarding <h:selectOneMenu>


>i have 2 concepts:
>
> //-----1-------------------
> u can put invisivle command button:
> to do this jus add style paramter with value
>   dispalay:none
> or
>   visibility:hidden
> (i cant remeber which is better)
> action of that button can determine selected value...
>
> u can add onchange="comboboxChanged()" parmaterer to your combobox.
> comboboxChanged() is javascript function that "clicks" your invisible 
> button.
> action binded to that button can determine value of combox and for example 
> return somme string that will be maped to view...
>
> //-----2-------------------------
> u can put three (or whatever u need) invisble buttons. each of them has 
> action that finally leads to desired view.
> that time your JS function must determine selection and "click" one of 
> invisble buttones (depending on selection)
> //============================
>
> summary:
> first method check selection on server but secod do that on client
> problem:
> when user drop down list and choose the _same_ value than nothing 
> happends:/
> u cant add onclick attrib cause it will be fired wher user drop down list 
> (before choose value)-what a shyt;)
>
>
> choose whatever matches your philosophy or sth;)
>
> cheers
>
> Sławek
>
>> Hi,
>>
>> How to navigate to some other page by just selecting one value from a 
>> drop down menu in JSF?
>> I mean you shd nt use the submit or link.
>> suppose there are 3 values in the drop down.
>> Now, depending on whatever you select , it should go to different page.
>> say, if i select first value, it shd go to first.jsp.
>> if i select second value then it shd go to second.jsp and so on.
>>
>> I am able to do this by using submit button but i am not able to do this 
>> without the button.
>>
>> the moment u select some value from the dropdown , some other jsp page 
>> shd come up depending on the value selected by the user.
>>
>> I am using JSF on WebSphere.
>>
>> Plz help guys.
>>
>> Thanx in Advance
>> Sunil
> 


Re: regarding

Posted by Slawek <ss...@o2.pl>.
i have 2 concepts:

//-----1-------------------
u can put invisivle command button:
to do this jus add style paramter with value
   dispalay:none
or
   visibility:hidden
(i cant remeber which is better)
action of that button can determine selected value...

u can add onchange="comboboxChanged()" parmaterer to your combobox.
comboboxChanged() is javascript function that "clicks" your invisible 
button.
action binded to that button can determine value of combox and for example 
return somme string that will be maped to view...

//-----2-------------------------
u can put three (or whatever u need) invisble buttons. each of them has 
action that finally leads to desired view.
that time your JS function must determine selection and "click" one of 
invisble buttones (depending on selection)
//============================

summary:
first method check selection on server but secod do that on client
problem:
when user drop down list and choose the _same_ value than nothing 
happends:/
u cant add onclick attrib cause it will be fired wher user drop down list 
(before choose value)-what a shyt;)


choose whatever matches your philosophy or sth;)

cheers

Sławek

> Hi,
>
> How to navigate to some other page by just selecting one value from a 
> drop down menu in JSF?
> I mean you shd nt use the submit or link.
> suppose there are 3 values in the drop down.
> Now, depending on whatever you select , it should go to different page.
> say, if i select first value, it shd go to first.jsp.
> if i select second value then it shd go to second.jsp and so on.
>
> I am able to do this by using submit button but i am not able to do this 
> without the button.
>
> the moment u select some value from the dropdown , some other jsp page 
> shd come up depending on the value selected by the user.
>
> I am using JSF on WebSphere.
>
> Plz help guys.
>
> Thanx in Advance
> Sunil