Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

navigating pages in JSF

Thread view: 
Pradyut - 30 Aug 2007 21:48 GMT
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/files/WebApplication1.zip

thanks

Pradyut
http://pradyut.tk
India
Lew - 30 Aug 2007 21:52 GMT
> 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>

Signature

Lew

Pradyut - 30 Aug 2007 22:08 GMT
> > Hi,
> >      I m using netbeans IDE 6.0. I want to know how to navigate pages
[quoted text clipped - 6 lines]
> --
> 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
Lew - 30 Aug 2007 22:24 GMT
>>> 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>

Signature

Lew

Lew - 30 Aug 2007 22:27 GMT
>>>> Hi,
>>>>      I m using netbeans IDE 6.0. I want to know how to navigate pages
[quoted text clipped - 14 lines]
>
> <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.

Signature

Lew

David Segall - 31 Aug 2007 16:42 GMT
>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.
Pradyut Bhattacharya - 01 Sep 2007 01:03 GMT
>>Hi,
>>     I m using netbeans IDE 6.0. I want to know how to navigate pages
[quoted text clipped - 12 lines]
> <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");

Pls some help

Thanks
Pradyut
http://pradyut.tk
India
Lew - 01 Sep 2007 02:57 GMT
> I'm still not getting it.....
> I'm using this code to retrive the values.......
[quoted text clipped - 4 lines]
>
> 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.

Signature

Lew

David Segall - 01 Sep 2007 07:11 GMT
>>>Hi,
>>>     I m using netbeans IDE 6.0. I want to know how to navigate pages
[quoted text clipped - 19 lines]
>        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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.