Unsubmitted sub-forms loosing values when using within

2009-04-21 Thread Babu Subburathinam
Hi,
When   is used within , subforms that are not
submitted loose value changes (they load values from the model even if
preserveSubmittedValues="true").

In the following UI Mark up, I make changes to the first name and first
score and click submit. Changes made to score are retained (as it is part of
the submitted sub-form) but changes made to name are not retained.

 
  

  

The controller is:

class ContentController
{
private List students; public List getStudents() { if
(null == students) { students = new ArrayList(10); for ( int i = 0;
i < 10 ; i++ ) { String studentName = "Name" + i; Student student = new
Student(); student.setName(studentName); student.setScore(i);
students.add(student); } } return students; } public String add() { return
null; }
}

Student.java:

public class Student { private String name; private int score; public String
getName() { return name; } public void setName( final String name ) {
this.name = name; } public int getScore() { return score; } public void
setScore( final int score ) { this.score = score; } }

Would appreciate any pointers on what could be going wrong.

TIA,
Babu


Re: how to add post-data to a redirect from an action

2009-04-21 Thread Walter Mourão
No, Sorry, I misunderstood your needs...


Walter Mourão
http://waltermourao.com.br
http://arcadian.com.br
http://oriens.com.br



On Tue, Apr 21, 2009 at 12:43 PM, Georg Füchsle wrote:

> Hallo Walter,
>
> thanks for Your reply.
>
> I have tried to understand what ist httpclient, but I am not shure if
> I am right.
>
> What I guess is that httpclient can manage the client-communication to
> a web server.
> That means I can make programs that interact with a webserver. (like
> calling an url with some data  and process the response.)
>
> What I want to do is: inside my WebApp - when the User pressed a
> button - I want to redirect the User to another WebApp on another
> server provided with some post-data. The answer to this request to the
> second WebApp should never arrive at my WebApp but should be
> interpreted by the User's browser.
>
> Do You think, httpclient can help me doing this?
>
> Thanks,
>
>
> Georg
>
> 2009/4/21 Walter Mourão :
> > Some time ago I wrote a small http proxy where an web service call
> generates
> > a http post. I used commons-httpclient:
> http://hc.apache.org/httpclient-3.x/
> > and it was quite useful.
> >
> > Cheers,
> >
> > Walter Mourão
> > http://waltermourao.com.br
> > http://arcadian.com.br
> > http://oriens.com.br
> >
> >
> >
> > On Tue, Apr 21, 2009 at 7:58 AM, Georg Füchsle 
> > wrote:
> >>
> >> Hallo Simon,
> >>
> >>
> >> Yes You have understood right: I want the user's browser to call
> >> another server and dont want to continue processing my application
> >> afterwards.
> >>
> >> I also have thought about the JavaScript solution.
> >> But using a js solution generally I will write the xml-data into the
> >> user's html. I did'nt like to do that, because this (xml-)data grants
> >> You access to the other application. For this reason I wanted to hide
> >> the xml-data. But using get-Parameters the xml-data is visible the
> >> same.
> >>
> >>
> >> Maybe should think about a ajax- functionality like this:
> >>
> >> I use a commandbutton that supports ajax-request and a hidden form
> >> that makes a post-request.
> >> When the user clickes the commandbutton i can fill the data of the
> >> form via ajax and then in an after-ajax-event click the submit-button
> >> of the form via JavaScript. Do You think this will work?
> >>
> >> I hoped, there would be an more easy way
> >>
> >> Thank You for Your help.
> >>
> >> Regards
> >>
> >>
> >> Georg
> >>
> >> 2009/4/21 Simon Kitching :
> >> > Georg Füchsle schrieb:
> >> >> hallo,
> >> >>
> >> >>
> >> >> I have to call another application out from JSF.
> >> >> To call this application i have to send (xml) data via post to the
> >> >> start-url of this application.
> >> >>
> >> >> I found some example on the web:
> >> >>
> >> >> 
> >> >> ExternalContext extContext =
> >> >> FacesContext.getCurrentInstance().ctx.getExternalContext();
> >> >> String name = URLEncoder.encode("INTERFACENAME", "utf-8");
> >> >> String someData = " 
> >> >> ";
> >> >> String value = URLEncoder.encode(someData , "UTF-8");
> >> >> String viewId = "http://www.server.com/startapp/index.html"+ '?' +
> >> >> name + "=" + value;
> >> >> String urlLink = extContext.encodeActionURL(viewId);
> >> >> extContext.redirect(urlLink);
> >> >> 
> >> >>
> >> >>
> >> >> I tried this code. its calls the new application, but the data is
> sent
> >> >> via GET:
> >> >>
> >> >>
> >> >>
> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding...
> ..
> >> >>
> >> >> So the intefacedata is easily be read by the user. Has anyone any
> idea
> >> >> how i can make a rediract with POST data?
> >> >
> >> > When you say "call another application out", do you mean that you want
> >> > the *user's browser* to send a POST command to some other server, and
> >> > then display the result returned from that server (without any further
> >> > processing)?
> >> >
> >> > HTTP provides no way to do this; the http-redirect facilities only do
> >> > GET commands. See the HTTP specification for more details. What your
> >> > code above does (extContext.redirect) just generates an http redirect
> >> > response, and the user's browser then processes this response and does
> >> > the redirect.
> >> >
> >> > HTML provides no way to do this either AFAIK.
> >> >
> >> > JSF just uses HTTP and HTML, so JSF also has no way to do this. I
> think
> >> > you will need to use javascript, ie generate an HTML page that
> contains
> >> > an html  with the fields you want, and some javascript that then
> >> > does document.getElementById(formId).submit() or something similar.
> >> >
> >> >
> >> > Or does "call another application out"mean that after a JSF submit,
> you
> >> > want *your server* to send a POST command to some other server, then
> >> > process the result before sending back a new page to the user? You can
> >> > use the apache commons-httpclient library to do things like this.
> >> >
> >> > Regards,
> >> > Simon
> >> >
> >> > --
> >> > -- Emails in "

Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Paul Freeman
I have attached a maven-based testcase to the JIRA issue. Much appreciated if 
someone could look into it...





From: Paul Freeman 
To: MyFaces Discussion 
Sent: Tuesday, April 21, 2009 6:40:22 PM
Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row 
from table


I think the JIRA issue has a reasonably standalone testcase so I can certainly 
turn that into a maven-based testcase over the next day or so. It will also 
help me validate whether or not I'm seeing exactly the same problem. 

Do you know if there's a maven archetype which includes trinidad and facelets? 
If you don't know off-hand then don't worry - I will get googling...





From: Andrew Robinson 
To: MyFaces Discussion 
Sent: Tuesday, April 21, 2009 6:29:07 PM
Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row 
from table

Could you submit a test case that builds using maven and runs with
jetty support (just a normal war pom setup and the jetty plugin can be
added easily)?

On Tue, Apr 21, 2009 at 9:41 AM, Paul Freeman  wrote:
> Just tried it and no luck :-(
>
> Note that the delete() method in my case is in context of a popped up dialog
> so the line:
>   UIXTable table =
> (UIXTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
> ... returned null so I got to the UIXTable object through an associated
> backing bean. Not sure whether any of this matters though...
>
> Assuming we can't think of a workaround, what are the chances of anyone in
> the core dev team being able to work on this? Or do I need to put some time
> aside to debug this myself?
>
> thanks
> Paul.
> 
> From: Matthias Wessendorf 
> To: MyFaces Discussion 
> Sent: Tuesday, April 21, 2009 4:11:58 PM
> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
> row from table
>
> one more guess.
>
> in the delete, did you try something like this ?
>
> public String delete()
> {
>   
>   List myList = // get the thing;
>   myList.remove(...);
>   // store the "change"
>
>   UIXTable table = (UIXTable)
> FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
>   table.setValue(myList);
>   RequestContext rc= RequestContext.getCurrentInstance();
>   rc.addPartialTarget(table);
>
> 
> }
>
> On Tue, Apr 21, 2009 at 3:42 PM, Paul Freeman  wrote:
>> Matthias - thanks for the response.
>>
>> We tried addPartialTarget on the table component itself - i.e. on the
>> action
>> method which deletes the object we tried calling addPartialTarget() on the
>> table. Unfortunately, that didn't help.
>>
>> We also tried adding a return listener on the commandButton which launched
>> the dialog (which contains a commandButton that subsequently deletes the
>> object) and then calling addPartialTarget from the return listener.
>> However,
>> it looks like the same issue causes the return listener not to be called -
>> i.e. if the action results in its commandButton disappearing then the
>> return
>> listener is not triggered.
>>
>> I've just tried addPartialTarget on the document and the UIViewRoot and no
>> joy I'm afraid..
>>
>> Any other pointers (or a fix!) would be really appreciated...
>>
>> thanks
>> Paul.
>>
>> 
>> From: Matthias Wessendorf 
>> To: MyFaces Discussion 
>> Sent: Tuesday, April 21, 2009 12:53:16 PM
>> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
>> row from table
>>
>> On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf 
>> wrote:
>>> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman 
>>> wrote:
 Hi all,

 We're about to go production on our web site within the next month, but
 we're hitting a number of issues caused by the above bug.. We see it not
 only
 on deleting rows from a table but also when updating certain tables -
 basically, PPR does not occur after any action which causes the source
 command link/button to disappear. This is a real showstopper for us.
>>>
>>> have you tried addPartialTarget() ?
>>> e.g. the component that contains the table ?
>>> (or even UIViewRoot) ?
>> or the Document component ?
>>>
>>> -Matthias
>>>

 Is there any chance any of the Trinidad gurus could look into this?

 thanks
 Paul.

>>>
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>>
>>> blog: http://matthiaswessendorf..wordpress.com/
>>> sessions: http://www.slideshare.net/mwessendorf
>>> twitter: http://twitter.com/mwessendorf
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>
>


  

Re: [Trinidad-Sandbox] trs:tableFormLayout renderer problem

2009-04-21 Thread Leonardo Uribe
Hi Glauco

Sorry for the late response, but right now I'm busy contributing to myfaces
core 2.0. I'll try to be as concrete and simple as possible to explain this
issue.

To understand how this component works you have first to check a working
example of it. Trinidad 1.2.8 is the nearest version that works with this
component. You can checkout the source code from here:

http://svn.apache.org/repos/asf/myfaces/trinidad/tags/trinidad-1.2.8/

Then change all trinidad-sandbox pom.xml versions from 1.2.8-SNAPSHOT to
1.2.8 (sandbox-api, sandbox-build, sandbox-impl, sandbox-demo and
trinidad-sandbox pom.xml), to make it compile.

Type on trinidad-sandbox directory:

mvn install

then:

cd sandbox-demo
mvn clean -PjettyConfig jetty:run

Then open your browser and type this address:

http://localhost:8080/sandbox-demo/faces/components/tableFormLayout.jspx

If everything is right (I tried all instructions) you should see the
component working. The important part here is have a reference of html
markup.

Now the problem. LabelAndMessageRenderer is the base renderer of all
"labeled" trinidad components. It works with tr:panelFormLayout to render
correctly components inside a html table rendered by this component. In few
words, when a labeled trinidad component is rendered alone it does something
like this (it is more complex than the example but the example shows the
idea):

"label""component"

 inside a tr:panelFormLayout or tr:tableFormLayout, LabelAndMessageRenderer
do something like this:

.some table stuff by the
container.."label""component"...some table stuff by the
container

>From this point of view the problem is simple, LabelAndMessageRenderer
should recognize the container in the same way as recognize
tr:panelFormLayout and render "almost" the same code as tr:panelFormLayout.

I hope this description helps to solve the problem

regards

Leonardo Uribe

On Wed, Apr 15, 2009 at 9:44 PM, Glauco P. Gomes
wrote:

> I'm interested in provide a patch to correct this, but I don't know where
> to start, can you guide me in the first steps?
>
> Glauco P. Gomes
>
> Leonardo Uribe escreveu:
>
>> Hi
>>
>> Yes, the demo fails. It seems that something changes on
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer
>> class, and "table" tags are added to surrounding labeled components (this
>> should not happen) , so the final result is that invalid html is generated.
>>
>> regards
>>
>> Leonardo Uribe
>>
>


Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Paul Freeman
I think the JIRA issue has a reasonably standalone testcase so I can certainly 
turn that into a maven-based testcase over the next day or so. It will also 
help me validate whether or not I'm seeing exactly the same problem. 

Do you know if there's a maven archetype which includes trinidad and facelets? 
If you don't know off-hand then don't worry - I will get googling





From: Andrew Robinson 
To: MyFaces Discussion 
Sent: Tuesday, April 21, 2009 6:29:07 PM
Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row 
from table

Could you submit a test case that builds using maven and runs with
jetty support (just a normal war pom setup and the jetty plugin can be
added easily)?

On Tue, Apr 21, 2009 at 9:41 AM, Paul Freeman  wrote:
> Just tried it and no luck :-(
>
> Note that the delete() method in my case is in context of a popped up dialog
> so the line:
>   UIXTable table =
> (UIXTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
> ... returned null so I got to the UIXTable object through an associated
> backing bean. Not sure whether any of this matters though...
>
> Assuming we can't think of a workaround, what are the chances of anyone in
> the core dev team being able to work on this? Or do I need to put some time
> aside to debug this myself?
>
> thanks
> Paul.
> 
> From: Matthias Wessendorf 
> To: MyFaces Discussion 
> Sent: Tuesday, April 21, 2009 4:11:58 PM
> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
> row from table
>
> one more guess.
>
> in the delete, did you try something like this ?
>
> public String delete()
> {
>   ...
>   List myList = // get the thing;
>   myList.remove(...);
>   // store the "change"
>
>   UIXTable table = (UIXTable)
> FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
>   table.setValue(myList);
>   RequestContext rc= RequestContext.getCurrentInstance();
>   rc.addPartialTarget(table);
>
> ...
> }
>
> On Tue, Apr 21, 2009 at 3:42 PM, Paul Freeman  wrote:
>> Matthias - thanks for the response.
>>
>> We tried addPartialTarget on the table component itself - i.e. on the
>> action
>> method which deletes the object we tried calling addPartialTarget() on the
>> table. Unfortunately, that didn't help.
>>
>> We also tried adding a return listener on the commandButton which launched
>> the dialog (which contains a commandButton that subsequently deletes the
>> object) and then calling addPartialTarget from the return listener.
>> However,
>> it looks like the same issue causes the return listener not to be called -
>> i.e. if the action results in its commandButton disappearing then the
>> return
>> listener is not triggered.
>>
>> I've just tried addPartialTarget on the document and the UIViewRoot and no
>> joy I'm afraid.
>>
>> Any other pointers (or a fix!) would be really appreciated...
>>
>> thanks
>> Paul.
>>
>> 
>> From: Matthias Wessendorf 
>> To: MyFaces Discussion 
>> Sent: Tuesday, April 21, 2009 12:53:16 PM
>> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
>> row from table
>>
>> On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf 
>> wrote:
>>> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman 
>>> wrote:
 Hi all,

 We're about to go production on our web site within the next month, but
 we're hitting a number of issues caused by the above bug. We see it not
 only
 on deleting rows from a table but also when updating certain tables -
 basically, PPR does not occur after any action which causes the source
 command link/button to disappear. This is a real showstopper for us.
>>>
>>> have you tried addPartialTarget() ?
>>> e.g. the component that contains the table ?
>>> (or even UIViewRoot) ?
>> or the Document component ?
>>>
>>> -Matthias
>>>

 Is there any chance any of the Trinidad gurus could look into this?

 thanks
 Paul.

>>>
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>>
>>> blog: http://matthiaswessendorf.wordpress.com/
>>> sessions: http://www.slideshare.net/mwessendorf
>>> twitter: http://twitter.com/mwessendorf
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>
>



  

Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Andrew Robinson
Could you submit a test case that builds using maven and runs with
jetty support (just a normal war pom setup and the jetty plugin can be
added easily)?

On Tue, Apr 21, 2009 at 9:41 AM, Paul Freeman  wrote:
> Just tried it and no luck :-(
>
> Note that the delete() method in my case is in context of a popped up dialog
> so the line:
>   UIXTable table =
> (UIXTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
> ... returned null so I got to the UIXTable object through an associated
> backing bean. Not sure whether any of this matters though...
>
> Assuming we can't think of a workaround, what are the chances of anyone in
> the core dev team being able to work on this? Or do I need to put some time
> aside to debug this myself?
>
> thanks
> Paul.
> 
> From: Matthias Wessendorf 
> To: MyFaces Discussion 
> Sent: Tuesday, April 21, 2009 4:11:58 PM
> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
> row from table
>
> one more guess.
>
> in the delete, did you try something like this ?
>
> public String delete()
> {
>   ...
>   List myList = // get the thing;
>   myList.remove(...);
>   // store the "change"
>
>   UIXTable table = (UIXTable)
> FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
>   table.setValue(myList);
>   RequestContext rc= RequestContext.getCurrentInstance();
>   rc.addPartialTarget(table);
>
> ...
> }
>
> On Tue, Apr 21, 2009 at 3:42 PM, Paul Freeman  wrote:
>> Matthias - thanks for the response.
>>
>> We tried addPartialTarget on the table component itself - i.e. on the
>> action
>> method which deletes the object we tried calling addPartialTarget() on the
>> table. Unfortunately, that didn't help.
>>
>> We also tried adding a return listener on the commandButton which launched
>> the dialog (which contains a commandButton that subsequently deletes the
>> object) and then calling addPartialTarget from the return listener.
>> However,
>> it looks like the same issue causes the return listener not to be called -
>> i.e. if the action results in its commandButton disappearing then the
>> return
>> listener is not triggered.
>>
>> I've just tried addPartialTarget on the document and the UIViewRoot and no
>> joy I'm afraid.
>>
>> Any other pointers (or a fix!) would be really appreciated...
>>
>> thanks
>> Paul.
>>
>> 
>> From: Matthias Wessendorf 
>> To: MyFaces Discussion 
>> Sent: Tuesday, April 21, 2009 12:53:16 PM
>> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
>> row from table
>>
>> On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf 
>> wrote:
>>> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman 
>>> wrote:
 Hi all,

 We're about to go production on our web site within the next month, but
 we're hitting a number of issues caused by the above bug. We see it not
 only
 on deleting rows from a table but also when updating certain tables -
 basically, PPR does not occur after any action which causes the source
 command link/button to disappear. This is a real showstopper for us.
>>>
>>> have you tried addPartialTarget() ?
>>> e.g. the component that contains the table ?
>>> (or even UIViewRoot) ?
>> or the Document component ?
>>>
>>> -Matthias
>>>

 Is there any chance any of the Trinidad gurus could look into this?

 thanks
 Paul.

>>>
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>>
>>> blog: http://matthiaswessendorf.wordpress.com/
>>> sessions: http://www.slideshare.net/mwessendorf
>>> twitter: http://twitter.com/mwessendorf
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>
>


Re: how to add post-data to a redirect from an action

2009-04-21 Thread Georg Füchsle
Hallo Walter,

thanks for Your reply.

I have tried to understand what ist httpclient, but I am not shure if
I am right.

What I guess is that httpclient can manage the client-communication to
a web server.
That means I can make programs that interact with a webserver. (like
calling an url with some data  and process the response.)

What I want to do is: inside my WebApp - when the User pressed a
button - I want to redirect the User to another WebApp on another
server provided with some post-data. The answer to this request to the
second WebApp should never arrive at my WebApp but should be
interpreted by the User's browser.

Do You think, httpclient can help me doing this?

Thanks,


Georg

2009/4/21 Walter Mourão :
> Some time ago I wrote a small http proxy where an web service call generates
> a http post. I used commons-httpclient: http://hc.apache.org/httpclient-3.x/
> and it was quite useful.
>
> Cheers,
>
> Walter Mourão
> http://waltermourao.com.br
> http://arcadian.com.br
> http://oriens.com.br
>
>
>
> On Tue, Apr 21, 2009 at 7:58 AM, Georg Füchsle 
> wrote:
>>
>> Hallo Simon,
>>
>>
>> Yes You have understood right: I want the user's browser to call
>> another server and dont want to continue processing my application
>> afterwards.
>>
>> I also have thought about the JavaScript solution.
>> But using a js solution generally I will write the xml-data into the
>> user's html. I did'nt like to do that, because this (xml-)data grants
>> You access to the other application. For this reason I wanted to hide
>> the xml-data. But using get-Parameters the xml-data is visible the
>> same.
>>
>>
>> Maybe should think about a ajax- functionality like this:
>>
>> I use a commandbutton that supports ajax-request and a hidden form
>> that makes a post-request.
>> When the user clickes the commandbutton i can fill the data of the
>> form via ajax and then in an after-ajax-event click the submit-button
>> of the form via JavaScript. Do You think this will work?
>>
>> I hoped, there would be an more easy way
>>
>> Thank You for Your help.
>>
>> Regards
>>
>>
>> Georg
>>
>> 2009/4/21 Simon Kitching :
>> > Georg Füchsle schrieb:
>> >> hallo,
>> >>
>> >>
>> >> I have to call another application out from JSF.
>> >> To call this application i have to send (xml) data via post to the
>> >> start-url of this application.
>> >>
>> >> I found some example on the web:
>> >>
>> >> 
>> >> ExternalContext extContext =
>> >> FacesContext.getCurrentInstance().ctx.getExternalContext();
>> >> String name = URLEncoder.encode("INTERFACENAME", "utf-8");
>> >> String someData = " 
>> >> ";
>> >> String value = URLEncoder.encode(someData , "UTF-8");
>> >> String viewId = "http://www.server.com/startapp/index.html"+ '?' +
>> >> name + "=" + value;
>> >> String urlLink = extContext.encodeActionURL(viewId);
>> >> extContext.redirect(urlLink);
>> >> 
>> >>
>> >>
>> >> I tried this code. its calls the new application, but the data is sent
>> >> via GET:
>> >>
>> >>
>> >> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding.
>> >>
>> >> So the intefacedata is easily be read by the user. Has anyone any idea
>> >> how i can make a rediract with POST data?
>> >
>> > When you say "call another application out", do you mean that you want
>> > the *user's browser* to send a POST command to some other server, and
>> > then display the result returned from that server (without any further
>> > processing)?
>> >
>> > HTTP provides no way to do this; the http-redirect facilities only do
>> > GET commands. See the HTTP specification for more details. What your
>> > code above does (extContext.redirect) just generates an http redirect
>> > response, and the user's browser then processes this response and does
>> > the redirect.
>> >
>> > HTML provides no way to do this either AFAIK.
>> >
>> > JSF just uses HTTP and HTML, so JSF also has no way to do this. I think
>> > you will need to use javascript, ie generate an HTML page that contains
>> > an html  with the fields you want, and some javascript that then
>> > does document.getElementById(formId).submit() or something similar.
>> >
>> >
>> > Or does "call another application out"mean that after a JSF submit, you
>> > want *your server* to send a POST command to some other server, then
>> > process the result before sending back a new page to the user? You can
>> > use the apache commons-httpclient library to do things like this.
>> >
>> > Regards,
>> > Simon
>> >
>> > --
>> > -- Emails in "mixed" posting style will be ignored
>> > -- (http://en.wikipedia.org/wiki/Posting_style)
>> >
>
>


Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Paul Freeman
Just tried it and no luck :-(

Note that the delete() method in my case is in context of a popped up dialog so 
the line:

  UIXTable table = 
(UIXTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");

... returned null so I got to the UIXTable object through an associated backing 
bean. Not sure whether any of this matters though...

Assuming we can't think of a workaround, what are the chances of anyone in the 
core dev team being able to work on this? Or do I need to put some time aside 
to debug this myself?

thanks
Paul.



From: Matthias Wessendorf 
To: MyFaces Discussion 
Sent: Tuesday, April 21, 2009 4:11:58 PM
Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row 
from table

one more guess.

in the delete, did you try something like this ?

public String delete()
{
  ...
  List myList = // get the thing;
  myList.remove(...);
  // store the "change"

  UIXTable table = (UIXTable)
FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
  table.setValue(myList);
  RequestContext rc= RequestContext.getCurrentInstance();
  rc.addPartialTarget(table);

...
}

On Tue, Apr 21, 2009 at 3:42 PM, Paul Freeman  wrote:
> Matthias - thanks for the response.
>
> We tried addPartialTarget on the table component itself - i.e. on the action
> method which deletes the object we tried calling addPartialTarget() on the
> table. Unfortunately, that didn't help.
>
> We also tried adding a return listener on the commandButton which launched
> the dialog (which contains a commandButton that subsequently deletes the
> object) and then calling addPartialTarget from the return listener. However,
> it looks like the same issue causes the return listener not to be called -
> i.e. if the action results in its commandButton disappearing then the return
> listener is not triggered.
>
> I've just tried addPartialTarget on the document and the UIViewRoot and no
> joy I'm afraid.
>
> Any other pointers (or a fix!) would be really appreciated...
>
> thanks
> Paul.
>
> 
> From: Matthias Wessendorf 
> To: MyFaces Discussion 
> Sent: Tuesday, April 21, 2009 12:53:16 PM
> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
> row from table
>
> On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf 
> wrote:
>> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman 
>> wrote:
>>> Hi all,
>>>
>>> We're about to go production on our web site within the next month, but
>>> we're hitting a number of issues caused by the above bug. We see it not
>>> only
>>> on deleting rows from a table but also when updating certain tables -
>>> basically, PPR does not occur after any action which causes the source
>>> command link/button to disappear. This is a real showstopper for us.
>>
>> have you tried addPartialTarget() ?
>> e.g. the component that contains the table ?
>> (or even UIViewRoot) ?
> or the Document component ?
>>
>> -Matthias
>>
>>>
>>> Is there any chance any of the Trinidad gurus could look into this?
>>>
>>> thanks
>>> Paul.
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf



  

Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Matthias Wessendorf
one more guess.

in the delete, did you try something like this ?

public String delete()
{
  ...
  List myList = // get the thing;
  myList.remove(...);
  // store the "change"

  UIXTable table = (UIXTable)
FacesContext.getCurrentInstance().getViewRoot().findComponent("tableId");
  table.setValue(myList);
  RequestContext rc= RequestContext.getCurrentInstance();
  rc.addPartialTarget(table);

...
}

On Tue, Apr 21, 2009 at 3:42 PM, Paul Freeman  wrote:
> Matthias - thanks for the response.
>
> We tried addPartialTarget on the table component itself - i.e. on the action
> method which deletes the object we tried calling addPartialTarget() on the
> table. Unfortunately, that didn't help.
>
> We also tried adding a return listener on the commandButton which launched
> the dialog (which contains a commandButton that subsequently deletes the
> object) and then calling addPartialTarget from the return listener. However,
> it looks like the same issue causes the return listener not to be called -
> i.e. if the action results in its commandButton disappearing then the return
> listener is not triggered.
>
> I've just tried addPartialTarget on the document and the UIViewRoot and no
> joy I'm afraid.
>
> Any other pointers (or a fix!) would be really appreciated...
>
> thanks
> Paul.
>
> 
> From: Matthias Wessendorf 
> To: MyFaces Discussion 
> Sent: Tuesday, April 21, 2009 12:53:16 PM
> Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last
> row from table
>
> On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf 
> wrote:
>> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman 
>> wrote:
>>> Hi all,
>>>
>>> We're about to go production on our web site within the next month, but
>>> we're hitting a number of issues caused by the above bug. We see it not
>>> only
>>> on deleting rows from a table but also when updating certain tables -
>>> basically, PPR does not occur after any action which causes the source
>>> command link/button to disappear. This is a real showstopper for us.
>>
>> have you tried addPartialTarget() ?
>> e.g. the component that contains the table ?
>> (or even UIViewRoot) ?
> or the Document component ?
>>
>> -Matthias
>>
>>>
>>> Is there any chance any of the Trinidad gurus could look into this?
>>>
>>> thanks
>>> Paul.
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Paul Freeman
Matthias - thanks for the response.

We tried addPartialTarget on the table component itself - i.e. on the action 
method which deletes the object we tried calling addPartialTarget() on the 
table. Unfortunately, that didn't help.

We also tried adding a return listener on the commandButton which launched the 
dialog (which contains a commandButton that subsequently deletes the object) 
and then calling addPartialTarget from the return listener. However, it looks 
like the same issue causes the return listener not to be called - i.e. if the 
action results in its commandButton disappearing then the return listener is 
not triggered.

I've just tried addPartialTarget on the document and the UIViewRoot and no joy 
I'm afraid.

Any other pointers (or a fix!) would be really appreciated...

thanks
Paul.

 




From: Matthias Wessendorf 
To: MyFaces Discussion 
Sent: Tuesday, April 21, 2009 12:53:16 PM
Subject: Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row 
from table

On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf  wrote:
> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman  wrote:
>> Hi all,
>>
>> We're about to go production on our web site within the next month, but
>> we're hitting a number of issues caused by the above bug. We see it not only
>> on deleting rows from a table but also when updating certain tables -
>> basically, PPR does not occur after any action which causes the source
>> command link/button to disappear. This is a real showstopper for us.
>
> have you tried addPartialTarget() ?
> e.g. the component that contains the table ?
> (or even UIViewRoot) ?
or the Document component ?
>
> -Matthias
>
>>
>> Is there any chance any of the Trinidad gurus could look into this?
>>
>> thanks
>> Paul.
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare..net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress..com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf



  

tree2 menu

2009-04-21 Thread mitroiasi


I have created a menu with the help of the tree2 component. 
But I have also on the same pages the buttons for next page and previous
page.
I want to change the selected item from the tree2 when the page is changed
by clicking on the next button.

I hope someone had implemented already this requirement and he can provide
me some hints. 
-- 
View this message in context: 
http://www.nabble.com/tree2-menu-tp23154563p23154563.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.



Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Matthias Wessendorf
On Tue, Apr 21, 2009 at 1:53 PM, Matthias Wessendorf  wrote:
> On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman  wrote:
>> Hi all,
>>
>> We're about to go production on our web site within the next month, but
>> we're hitting a number of issues caused by the above bug. We see it not only
>> on deleting rows from a table but also when updating certain tables -
>> basically, PPR does not occur after any action which causes the source
>> command link/button to disappear. This is a real showstopper for us.
>
> have you tried addPartialTarget() ?
> e.g. the component that contains the table ?
> (or even UIViewRoot) ?
or the Document component ?
>
> -Matthias
>
>>
>> Is there any chance any of the Trinidad gurus could look into this?
>>
>> thanks
>> Paul.
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


Re: [Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Matthias Wessendorf
On Tue, Apr 21, 2009 at 1:31 PM, Paul Freeman  wrote:
> Hi all,
>
> We're about to go production on our web site within the next month, but
> we're hitting a number of issues caused by the above bug. We see it not only
> on deleting rows from a table but also when updating certain tables -
> basically, PPR does not occur after any action which causes the source
> command link/button to disappear. This is a real showstopper for us.

have you tried addPartialTarget() ?
e.g. the component that contains the table ?
(or even UIViewRoot) ?

-Matthias

>
> Is there any chance any of the Trinidad gurus could look into this?
>
> thanks
> Paul.
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


Re: [Trinidad 1.0.10] error in TrRegExpValidator

2009-04-21 Thread Matthias Wessendorf
On Tue, Apr 21, 2009 at 11:05 AM,   wrote:
> Hi,
>
> I was running in an issue in Trinidad. I have used the following tag
>  and I was wondering why nothing has
> matched with my pattern. So I was going to debug the JavaScript
> implementation of TrRegExpValidator.prototype.validate function and I
> have seen that the match function was invoked with a wrong parameter
> (instead of exactPattern, this.exactPattern was used). This would never
> match because TrRegExpValidator has no member variable. Should I file a
> Jira issue for this?

See here:
https://issues.apache.org/jira/browse/TRINIDAD-1181

already fixed in the 1.0.x trunk.
I guess there will be no release of 1.0.x before end of May..
Is it possible to use that trunk version ?

-Matthias

>
> Best Regards,
>
> Sven Rottstock
>
>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


[Trinidad] TRINIDAD-779 PPR not triggered when deleting last row from table

2009-04-21 Thread Paul Freeman
Hi all,

We're about to go production on our web site within the next month, but we're 
hitting a number of issues caused by the above bug. We see it not only on 
deleting rows from a table but also when updating certain tables - basically, 
PPR does not occur after any action which causes the source command link/button 
to disappear. This is a real showstopper for us. 

Is there any chance any of the Trinidad gurus could look into this? 

thanks
Paul.


  

[Trinidad 1.0.10] error in TrRegExpValidator

2009-04-21 Thread Sven.Rottstock
Hi,

I was running in an issue in Trinidad. I have used the following tag
 and I was wondering why nothing has
matched with my pattern. So I was going to debug the JavaScript
implementation of TrRegExpValidator.prototype.validate function and I
have seen that the match function was invoked with a wrong parameter
(instead of exactPattern, this.exactPattern was used). This would never
match because TrRegExpValidator has no member variable. Should I file a
Jira issue for this?

Best Regards,

Sven Rottstock





Re: how to add post-data to a redirect from an action

2009-04-21 Thread Walter Mourão
Some time ago I wrote a small http proxy where an web service call generates
a http post. I used commons-httpclient:
http://hc.apache.org/httpclient-3.x/and it was quite useful.

Cheers,

Walter Mourão
http://waltermourao.com.br
http://arcadian.com.br
http://oriens.com.br



On Tue, Apr 21, 2009 at 7:58 AM, Georg Füchsle wrote:

> Hallo Simon,
>
>
> Yes You have understood right: I want the user's browser to call
> another server and dont want to continue processing my application
> afterwards.
>
> I also have thought about the JavaScript solution.
> But using a js solution generally I will write the xml-data into the
> user's html. I did'nt like to do that, because this (xml-)data grants
> You access to the other application. For this reason I wanted to hide
> the xml-data. But using get-Parameters the xml-data is visible the
> same.
>
>
> Maybe should think about a ajax- functionality like this:
>
> I use a commandbutton that supports ajax-request and a hidden form
> that makes a post-request.
> When the user clickes the commandbutton i can fill the data of the
> form via ajax and then in an after-ajax-event click the submit-button
> of the form via JavaScript. Do You think this will work?
>
> I hoped, there would be an more easy way
>
> Thank You for Your help.
>
> Regards
>
>
> Georg
>
> 2009/4/21 Simon Kitching :
> > Georg Füchsle schrieb:
> >> hallo,
> >>
> >>
> >> I have to call another application out from JSF.
> >> To call this application i have to send (xml) data via post to the
> >> start-url of this application.
> >>
> >> I found some example on the web:
> >>
> >> 
> >> ExternalContext extContext =
> >> FacesContext.getCurrentInstance().ctx.getExternalContext();
> >> String name = URLEncoder.encode("INTERFACENAME", "utf-8");
> >> String someData = " 
> >> ";
> >> String value = URLEncoder.encode(someData , "UTF-8");
> >> String viewId = "http://www.server.com/startapp/index.html"+ '?' +
> >> name + "=" + value;
> >> String urlLink = extContext.encodeActionURL(viewId);
> >> extContext.redirect(urlLink);
> >> 
> >>
> >>
> >> I tried this code. its calls the new application, but the data is sent
> via GET:
> >>
> >>
> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding...
> ..
> >>
> >> So the intefacedata is easily be read by the user. Has anyone any idea
> >> how i can make a rediract with POST data?
> >
> > When you say "call another application out", do you mean that you want
> > the *user's browser* to send a POST command to some other server, and
> > then display the result returned from that server (without any further
> > processing)?
> >
> > HTTP provides no way to do this; the http-redirect facilities only do
> > GET commands. See the HTTP specification for more details. What your
> > code above does (extContext.redirect) just generates an http redirect
> > response, and the user's browser then processes this response and does
> > the redirect.
> >
> > HTML provides no way to do this either AFAIK.
> >
> > JSF just uses HTTP and HTML, so JSF also has no way to do this. I think
> > you will need to use javascript, ie generate an HTML page that contains
> > an html  with the fields you want, and some javascript that then
> > does document.getElementById(formId).submit() or something similar.
> >
> >
> > Or does "call another application out"mean that after a JSF submit, you
> > want *your server* to send a POST command to some other server, then
> > process the result before sending back a new page to the user? You can
> > use the apache commons-httpclient library to do things like this.
> >
> > Regards,
> > Simon
> >
> > --
> > -- Emails in "mixed" posting style will be ignored
> > -- (http://en.wikipedia.org/wiki/Posting_style)
> >
>


Re: how to add post-data to a redirect from an action

2009-04-21 Thread Georg Füchsle
Hallo Simon,


Yes You have understood right: I want the user's browser to call
another server and dont want to continue processing my application
afterwards.

I also have thought about the JavaScript solution.
But using a js solution generally I will write the xml-data into the
user's html. I did'nt like to do that, because this (xml-)data grants
You access to the other application. For this reason I wanted to hide
the xml-data. But using get-Parameters the xml-data is visible the
same.


Maybe should think about a ajax- functionality like this:

I use a commandbutton that supports ajax-request and a hidden form
that makes a post-request.
When the user clickes the commandbutton i can fill the data of the
form via ajax and then in an after-ajax-event click the submit-button
of the form via JavaScript. Do You think this will work?

I hoped, there would be an more easy way

Thank You for Your help.

Regards


Georg

2009/4/21 Simon Kitching :
> Georg Füchsle schrieb:
>> hallo,
>>
>>
>> I have to call another application out from JSF.
>> To call this application i have to send (xml) data via post to the
>> start-url of this application.
>>
>> I found some example on the web:
>>
>> 
>> ExternalContext extContext =
>> FacesContext.getCurrentInstance().ctx.getExternalContext();
>> String name = URLEncoder.encode("INTERFACENAME", "utf-8");
>> String someData = " 
>> ";
>> String value = URLEncoder.encode(someData , "UTF-8");
>> String viewId = "http://www.server.com/startapp/index.html"+ '?' +
>> name + "=" + value;
>> String urlLink = extContext.encodeActionURL(viewId);
>> extContext.redirect(urlLink);
>> 
>>
>>
>> I tried this code. its calls the new application, but the data is sent via 
>> GET:
>>
>> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding.
>>
>> So the intefacedata is easily be read by the user. Has anyone any idea
>> how i can make a rediract with POST data?
>
> When you say "call another application out", do you mean that you want
> the *user's browser* to send a POST command to some other server, and
> then display the result returned from that server (without any further
> processing)?
>
> HTTP provides no way to do this; the http-redirect facilities only do
> GET commands. See the HTTP specification for more details. What your
> code above does (extContext.redirect) just generates an http redirect
> response, and the user's browser then processes this response and does
> the redirect.
>
> HTML provides no way to do this either AFAIK.
>
> JSF just uses HTTP and HTML, so JSF also has no way to do this. I think
> you will need to use javascript, ie generate an HTML page that contains
> an html  with the fields you want, and some javascript that then
> does document.getElementById(formId).submit() or something similar.
>
>
> Or does "call another application out"mean that after a JSF submit, you
> want *your server* to send a POST command to some other server, then
> process the result before sending back a new page to the user? You can
> use the apache commons-httpclient library to do things like this.
>
> Regards,
> Simon
>
> --
> -- Emails in "mixed" posting style will be ignored
> -- (http://en.wikipedia.org/wiki/Posting_style)
>


Re: show selected item in a tree2 component

2009-04-21 Thread mitroiasi


Hi

After some searching and trying some solutions I came across this page:
http://wiki.apache.org/myfaces/Tree2 (section about navigation).
I have tried to implement the described solution but with no luck.

Can someone provide me with an ample solution for this problem (more code &
explanations).

I am stuck in this problem and I will be very glad to hear a solution. 
-- 
View this message in context: 
http://www.nabble.com/show-selected-item-in-a-tree2-component-tp23076594p23152477.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.



Re: [JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Anton Gavazuk
Hi Adrian,

looks interesting - will give it a try also,
thanks.

2009/4/21 Adrian Mitev 

> On Tue, Apr 21, 2009 at 11:53 AM, Anton Gavazuk 
> wrote:
> > Hi Matthias,
> >
> > thank you for the answer,
> >
> >>>One option could be doing some sort of logic (e.g. extracting req
> >>>param) in the constructor
> > that was my point - I dont like this way: in case of an exception (no
> object
> > with Id found)/an alternative navigationc case  I would need call from
> > constructor (postCreate method) facesContext..
> > navigateMethod - its ugly.
> >
> > will look on this lib.
> > http://jsf-comp.sourceforge.net/components/on-load/index.html
> >
> >
>
> You could also take a look at pretty faces -
> http://ocpsoft.com/prettyfaces/
>
> --
> Although nobody can come back and make a new start, anyone can start
> now and make a new end
>


Re: [JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Adrian Mitev
On Tue, Apr 21, 2009 at 11:53 AM, Anton Gavazuk  wrote:
> Hi Matthias,
>
> thank you for the answer,
>
>>>One option could be doing some sort of logic (e.g. extracting req
>>>param) in the constructor
> that was my point - I dont like this way: in case of an exception (no object
> with Id found)/an alternative navigationc case  I would need call from
> constructor (postCreate method) facesContext..
> navigateMethod - its ugly.
>
> will look on this lib.
> http://jsf-comp.sourceforge.net/components/on-load/index.html
>
>

You could also take a look at pretty faces - http://ocpsoft.com/prettyfaces/

-- 
Although nobody can come back and make a new start, anyone can start
now and make a new end


Re: [JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Matthias Wessendorf
On Tue, Apr 21, 2009 at 10:53 AM, Anton Gavazuk  wrote:
> Hi Matthias,
>
> thank you for the answer,
>
>>>One option could be doing some sort of logic (e.g. extracting req
>>>param) in the constructor
> that was my point - I dont like this way: in case of an exception (no object

sure, nobody really likes it.
ViewControllers, e.g. Shale or Orchestra jump in here

Also, Seam's pageActions are similar

-M

> with Id found)/an alternative navigationc case  I would need call from
> constructor (postCreate method) facesContext..
> navigateMethod - its ugly.
>
> will look on this lib.
> http://jsf-comp.sourceforge.net/components/on-load/index.html
>
>
> Thanks,
> Anton
>
>
>
> 2009/4/21 Matthias Wessendorf 
>>
>> On Tue, Apr 21, 2009 at 10:24 AM, Anton Gavazuk 
>> wrote:
>> > Hi all,
>> >
>> > I need advice/suggest for such situation:
>> >
>> > is there any way to execute an action in bean/(in listener) when user
>> > requests certain jsf page? - for example: /customer/edit.jsf?id=172387
>> >
>> > Why I need this: I want to make some preprocessing logic before showing
>> > the
>> > final page.
>> >
>> > I know there is possibility to make this by @PostCreate execution, but
>> > maybe
>> > there are other ways, more convenient?
>>
>> One option could be doing some sort of logic (e.g. extracting req
>> param) in the constructor
>> of a backing bean.
>>
>> Another option is using Orchestra's view controller
>>
>> Or, using this tool:
>>
>> http://jsf-comp.sourceforge.net/components/on-load/index.html
>>
>> >
>> > Thanks,
>> > Anton.
>> >
>> >
>> >
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


Re: [JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Anton Gavazuk
Hi Matthias,

thank you for the answer,

>>One option could be doing some sort of logic (e.g. extracting req
>>param) in the constructor
that was my point - I dont like this way: in case of an exception (no object
with Id found)/an alternative navigationc case  I would need call from
constructor (postCreate method) facesContext..
navigateMethod - its ugly.

will look on this lib.
http://jsf-comp.sourceforge.net/components/on-load/index.html


Thanks,
Anton



2009/4/21 Matthias Wessendorf 

> On Tue, Apr 21, 2009 at 10:24 AM, Anton Gavazuk 
> wrote:
> > Hi all,
> >
> > I need advice/suggest for such situation:
> >
> > is there any way to execute an action in bean/(in listener) when user
> > requests certain jsf page? - for example: /customer/edit.jsf?id=172387
> >
> > Why I need this: I want to make some preprocessing logic before showing
> the
> > final page.
> >
> > I know there is possibility to make this by @PostCreate execution, but
> maybe
> > there are other ways, more convenient?
>
> One option could be doing some sort of logic (e.g. extracting req
> param) in the constructor
> of a backing bean.
>
> Another option is using Orchestra's view controller
>
> Or, using this tool:
>
> http://jsf-comp.sourceforge.net/components/on-load/index.html
>
> >
> > Thanks,
> > Anton.
> >
> >
> >
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>


Re: [JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Matthias Wessendorf
On Tue, Apr 21, 2009 at 10:24 AM, Anton Gavazuk  wrote:
> Hi all,
>
> I need advice/suggest for such situation:
>
> is there any way to execute an action in bean/(in listener) when user
> requests certain jsf page? - for example: /customer/edit.jsf?id=172387
>
> Why I need this: I want to make some preprocessing logic before showing the
> final page.
>
> I know there is possibility to make this by @PostCreate execution, but maybe
> there are other ways, more convenient?

One option could be doing some sort of logic (e.g. extracting req
param) in the constructor
of a backing bean.

Another option is using Orchestra's view controller

Or, using this tool:

http://jsf-comp.sourceforge.net/components/on-load/index.html

>
> Thanks,
> Anton.
>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf


[JSF] How to execute action directly from link (like struts action)

2009-04-21 Thread Anton Gavazuk
Hi all,

I need advice/suggest for such situation:

is there any way to execute an action in bean/(in listener) when user
requests certain jsf page? - for example: /customer/edit.jsf?id=172387

Why I need this: I want to make some preprocessing logic before showing the
final page.

I know there is possibility to make this by @PostCreate execution, but maybe
there are other ways, more convenient?

Thanks,
Anton.


Re: how to add post-data to a redirect from an action

2009-04-21 Thread Simon Kitching
Georg Füchsle schrieb:
> hallo,
> 
> 
> I have to call another application out from JSF.
> To call this application i have to send (xml) data via post to the
> start-url of this application.
> 
> I found some example on the web:
> 
> 
> ExternalContext extContext =
> FacesContext.getCurrentInstance().ctx.getExternalContext();
> String name = URLEncoder.encode("INTERFACENAME", "utf-8");
> String someData = " 
> ";
> String value = URLEncoder.encode(someData , "UTF-8");
> String viewId = "http://www.server.com/startapp/index.html"+ '?' +
> name + "=" + value;
> String urlLink = extContext.encodeActionURL(viewId);
> extContext.redirect(urlLink);
> 
> 
> 
> I tried this code. its calls the new application, but the data is sent via 
> GET:
> 
> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding.
> 
> So the intefacedata is easily be read by the user. Has anyone any idea
> how i can make a rediract with POST data?

When you say "call another application out", do you mean that you want
the *user's browser* to send a POST command to some other server, and
then display the result returned from that server (without any further
processing)?

HTTP provides no way to do this; the http-redirect facilities only do
GET commands. See the HTTP specification for more details. What your
code above does (extContext.redirect) just generates an http redirect
response, and the user's browser then processes this response and does
the redirect.

HTML provides no way to do this either AFAIK.

JSF just uses HTTP and HTML, so JSF also has no way to do this. I think
you will need to use javascript, ie generate an HTML page that contains
an html  with the fields you want, and some javascript that then
does document.getElementById(formId).submit() or something similar.


Or does "call another application out"mean that after a JSF submit, you
want *your server* to send a POST command to some other server, then
process the result before sending back a new page to the user? You can
use the apache commons-httpclient library to do things like this.

Regards,
Simon

-- 
-- Emails in "mixed" posting style will be ignored
-- (http://en.wikipedia.org/wiki/Posting_style)


how to add post-data to a redirect from an action

2009-04-21 Thread Georg Füchsle
hallo,


I have to call another application out from JSF.
To call this application i have to send (xml) data via post to the
start-url of this application.

I found some example on the web:


ExternalContext extContext =
FacesContext.getCurrentInstance().ctx.getExternalContext();
String name = URLEncoder.encode("INTERFACENAME", "utf-8");
String someData = " 
";
String value = URLEncoder.encode(someData , "UTF-8");
String viewId = "http://www.server.com/startapp/index.html"+ '?' +
name + "=" + value;
String urlLink = extContext.encodeActionURL(viewId);
extContext.redirect(urlLink);



I tried this code. its calls the new application, but the data is sent via GET:

http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding.

So the intefacedata is easily be read by the user. Has anyone any idea
how i can make a rediract with POST data?

Thanks

Gio