Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > navigating pages in JSF

Reply
Thread Tools

navigating pages in JSF

 
 
Pradyut
Guest
Posts: n/a
 
      08-30-2007
Hi,
I m using netbeans IDE 6.0. I want to know how to navigate pages
in JSF. I can forward from one page to another using page navigation
but want to know how to send and retrieve parameters in JSF pages...

I have uploaded the netbeans project here.....
http://myjavaserver.com/~pradyut/fil...plication1.zip

thanks

Pradyut
http://pradyut.tk
India

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      08-30-2007
Pradyut wrote:
> Hi,
> I m using netbeans IDE 6.0. I want to know how to navigate pages
> in JSF. I can forward from one page to another using page navigation
> but want to know how to send and retrieve parameters in JSF pages...


<http://java.sun.com/javaee/5/docs/tutorial/doc/JSFIntro6.html#wp115538>
<http://java.sun.com/javaee/5/docs/tutorial/doc/JSFPage10.html#wp119785>

--
Lew
 
Reply With Quote
 
 
 
 
Pradyut
Guest
Posts: n/a
 
      08-30-2007
On Aug 31, 1:52 am, Lew <(E-Mail Removed)> wrote:
> Pradyut wrote:
> > Hi,
> > I m using netbeans IDE 6.0. I want to know how to navigate pages
> > in JSF. I can forward from one page to another using page navigation
> > but want to know how to send and retrieve parameters in JSF pages...

>
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFIntro6.html#wp115538>
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFPage10.html#wp119785>
>
> --
> Lew


I can navigate to a different page and can forward to different pages
depending on the form validations. But i cannot forward the parameters
like textfield to the forwarded page nor do i know to retrieve the
values.

thanks
Pradyut
http://pradyut.tk
India

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      08-30-2007
Pradyut wrote:
> On Aug 31, 1:52 am, Lew <(E-Mail Removed)> wrote:
>> Pradyut wrote:
>>> Hi,
>>> I m using netbeans IDE 6.0. I want to know how to navigate pages
>>> in JSF. I can forward from one page to another using page navigation
>>> but want to know how to send and retrieve parameters in JSF pages...

>> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFIntro6.html#wp115538>
>> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFPage10.html#wp119785>


> I can navigate to a different page and can forward to different pages
> depending on the form validations. But i cannot forward the parameters
> like textfield to the forwarded page nor do i know to retrieve the
> values.


The managed-bean element in the faces-config.xml can specify that a property
be initialized from a session value. You can either declare a (small!)
managed-bean of session scope or explicitly place an attribute in the session
in your forwarding page's backing bean's action method.

<http://java.sun.com/javaee/5/docs/tutorial/doc/JSFConfigure3.html#wp1000014>

--
Lew
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      08-30-2007
Lew wrote:
> Pradyut wrote:
>> On Aug 31, 1:52 am, Lew <(E-Mail Removed)> wrote:
>>> Pradyut wrote:
>>>> Hi,
>>>> I m using netbeans IDE 6.0. I want to know how to navigate pages
>>>> in JSF. I can forward from one page to another using page navigation
>>>> but want to know how to send and retrieve parameters in JSF pages...
>>> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFIntro6.html#wp115538>
>>> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFPage10.html#wp119785>

>
>> I can navigate to a different page and can forward to different pages
>> depending on the form validations. But i cannot forward the parameters
>> like textfield to the forwarded page nor do i know to retrieve the
>> values.

>
> The managed-bean element in the faces-config.xml can specify that a
> property be initialized from a session value. You can either declare a
> (small!) managed-bean of session scope or explicitly place an attribute
> in the session in your forwarding page's backing bean's action method.
>
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFConfigure3.html#wp1000014>


It doesn't even have to be session scope. I haven't tried it with JSF yet
myself, but in my own MVC-cycle servlets in non-JSF projects I just placed
attributes in the request, which avoids a host of session-related
complications. I betcha JSF supports that sort of thing, too. Place the
attribute in the request (not the session) and refer to it in the
managed-property via the EL with a scoped attribute.

--
Lew
 
Reply With Quote
 
David Segall
Guest
Posts: n/a
 
      08-31-2007
Pradyut <(E-Mail Removed)> wrote:

>Hi,
> I m using netbeans IDE 6.0. I want to know how to navigate pages
>in JSF. I can forward from one page to another using page navigation
>but want to know how to send and retrieve parameters in JSF pages...

JSF expects the parameters to be properties of a managed bean. If you
use the Visual Web Pack <http://www.netbeans.org/products/visualweb/>
to develop your JSF project then it will handle the details of
managing the managed beans. If you don't use the Visual Web Pack you
will need to write the beans yourself and write the XML to tell the
server about them. In either case you will need to do some reading on
the scope of the beans and how to set and get the variables in them.

If you must use GET data to send parameters I have a brief note on how
to retrieve them from a JSF page at
<http://www.profectus.com.au/ee_getdata.html>. The task is complex if
you don't use the Visual Web Pack and trivial if you do.
 
Reply With Quote
 
Pradyut Bhattacharya
Guest
Posts: n/a
 
      09-01-2007

"David Segall" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pradyut <(E-Mail Removed)> wrote:
>
>>Hi,
>> I m using netbeans IDE 6.0. I want to know how to navigate pages
>>in JSF. I can forward from one page to another using page navigation
>>but want to know how to send and retrieve parameters in JSF pages...

> JSF expects the parameters to be properties of a managed bean. If you
> use the Visual Web Pack <http://www.netbeans.org/products/visualweb/>
> to develop your JSF project then it will handle the details of
> managing the managed beans. If you don't use the Visual Web Pack you
> will need to write the beans yourself and write the XML to tell the
> server about them. In either case you will need to do some reading on
> the scope of the beans and how to set and get the variables in them.
>
> If you must use GET data to send parameters I have a brief note on how
> to retrieve them from a JSF page at
> <http://www.profectus.com.au/ee_getdata.html>. The task is complex if
> you don't use the Visual Web Pack and trivial if you do.


I'm still not getting it.....
I'm using this code to retrive the values.......

FacesContext fc = FacesContext.getCurrentInstance();
String id = (String)
fc.getExternalContext().getRequestParameterMap().g et("Page1.textField1");

Pls some help

Thanks
Pradyut
http://pradyut.tk
India


 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      09-01-2007
Pradyut Bhattacharya wrote:
> I'm still not getting it.....
> I'm using this code to retrive the values.......
>
> FacesContext fc = FacesContext.getCurrentInstance();
> String id = (String)
> fc.getExternalContext().getRequestParameterMap().g et("Page1.textField1");
>
> Pls [sic] some help


Did you read the links I suggested?
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFIntro6.html#wp115538>
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFPage10.html#wp119785>
> <http://java.sun.com/javaee/5/docs/tutorial/doc/JSFConfigure3.html#wp1000014>


You don't use explicit code like that to retrieve values. You do it by
binding your "value" attribute to a backing bean property, which bean is
specified in the faces-config.xml. JSF does the mapping for you.

Read the part about the JSF life cycle in the tutorial. Study it thoroughly.
Let us know that you've read the material before you repeat your questions
again. Then if you have specific questions about the material you can ask
them based on your reading, which you must do first.

--
Lew
 
Reply With Quote
 
David Segall
Guest
Posts: n/a
 
      09-01-2007
"Pradyut Bhattacharya" <(E-Mail Removed)> wrote:

>
>"David Segall" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>> Pradyut <(E-Mail Removed)> wrote:
>>
>>>Hi,
>>> I m using netbeans IDE 6.0. I want to know how to navigate pages
>>>in JSF. I can forward from one page to another using page navigation
>>>but want to know how to send and retrieve parameters in JSF pages...

>> JSF expects the parameters to be properties of a managed bean. If you
>> use the Visual Web Pack <http://www.netbeans.org/products/visualweb/>
>> to develop your JSF project then it will handle the details of
>> managing the managed beans. If you don't use the Visual Web Pack you
>> will need to write the beans yourself and write the XML to tell the
>> server about them. In either case you will need to do some reading on
>> the scope of the beans and how to set and get the variables in them.
>>
>> If you must use GET data to send parameters I have a brief note on how
>> to retrieve them from a JSF page at
>> <http://www.profectus.com.au/ee_getdata.html>. The task is complex if
>> you don't use the Visual Web Pack and trivial if you do.

>
>I'm still not getting it.....
>I'm using this code to retrive the values.......
>
> FacesContext fc = FacesContext.getCurrentInstance();
> String id = (String)
>fc.getExternalContext().getRequestParameterMap(). get("Page1.textField1");

This is definitely wrong but I can't guess what it should be from this
fragment. JSF expects the data to be passed via a managed bean so if
you are simply passing data from one JSF page to another you should
not be using a FacesContext.

An explanation of managed beans requires an entire chapter in any JSF
text book and it is not possible to give you some cookbook code in a
Usenet post.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a Master Sheet control when navigating between content pages Stratum ASP .Net 2 06-25-2007 01:56 PM
Navigating between pages mimoh Java 0 08-15-2006 12:54 AM
Include JSF page within another JSF page BlackIce Java 1 07-05-2006 11:24 PM
JSF debugging / JSF newsgroup Sebastian Fey Java 1 04-07-2006 08:52 PM
[JSF]Need to deploy a jsf application on SunApplicationServer. dudu Java 0 03-03-2006 12:09 PM



Advertisments