Hi, i want to send a parameter with <h:outputlink> from one page (index.jsp) to another page (detail.jsp) and use this parameter on detail.jsp to create a instance of a ManagedBean.
Is this possible?
If this works, what do i have to do to read out the parameter on detail.jsp and how can create a new Instance of a managedbean with this initial parameter while loding detail.jsp?
The essence of a ManagedBean is that JSF manages it. Construction and initialization of managed beans is done via (originally) faces-config.xml or the @ManagedProperty annotation (JSF2). The Managed property value is an EL expression, not a page parameter.
It is bad practice to pass parameters back and forth between pages and backing beans anyway. JSF's architectural basis is the Inversion of Control (IoC) paradigm, which says that outside agencies inject values into a bean, rather than passing them as parameters or making the bean use a Service Locator to pull values in.
In other words, the idea is that beans and bean construction properties are handled entirely within the server, not between server and client.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 16, 2012
Okey Thank you.
That´s my first application i want to build with jsf...so i´m really new here...maybe you can help me withe these problem.
Here is a short explanation what i want to do:
The first page shows a list of some journeys. The Information comes through a SQL-Statement into the journey-bean in a ArrayList. The View works fine with a <h:datatable>.
Then i want to click on one of that into the table and show a detail overview about the journey. (On a new Page)
Therefor I have to send a new SQL-Statement with the ID of the journey against the database. The ID is also stored into the ArrayList.
Google "JSF for nonbelievers" (IBM DeveloperWorks).
If you're just starting JSF, here's 2 bits of useful advice:
1. Excluding JSF model objects, the more "javax.faces" code and objects in your backing beans, the more likely you're doing things the hard way.
2. Likewise, the more your View Template (xhtml) looks like a program than a static template, same thing.
I guess I should mention another common thing. Newbies tend to overuse bindings and listeners. I think there's some stale JSF documentation out on the Internet that won't die relating to before more civilized techniques were developed.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Getting parameter from Link to create ManagedBean-Instance