Tim Wise

Greenhorn
+ Follow
since Jul 25, 2009
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Wise

Hello again,

I've found out what was the difference between the application built by IDEA and my own one. IDEA doesn't package classes into a jar.

So, to sum up, if classes end up in /WEB-INF/classes, but not /WEB-INF/lib/myjar.jar - then everything works fine. Otherwise - managed beans are not identified by annotations. That's really strange for me. Although I have a workaround now (do not pack classes into jar) - I'm still curious why is it that JSF annotations are not considered for classes in jar...

Tim
13 years ago
JSF
Hello,

I face some weird (to my mind ) exception with my facelet-based applicaiton. I have a session-scoped managed bean and an xhtml page using it. The managed bean is defined in faces-config.xml and it works fine. The weird thing - is that when I remove its declaration from faces-config.xml and add appropriate annotations into managed bean class - I get the error (stacktrace below). Even more - all these is true only when I build and deploy the application into Tomcat (Tomcat 6.0) manually. When my IDE does it (IDEA) - everything works fine and I even get message that the managed bean is loaded twice (a warning in logs). In other words, it looks like when I build and deploy my application manually - it doesn't process annotations for managed beans.

I've searched google and found out that there are similar problems, but non of the prosposed solutions helped me - my faces-config.xml is OK (verison 2.0), annotations are correct (I hope - my code is below), and I've tried to change the bean scope as well - it doesn't work for me. I've also tried removing <f:view> from my xhtml (previoulsy I was using pure JSF 1.2) - the same thing - this doesn't help.

I will appreciate any help

Thanks,
Tim

P.S. I use mojarra JSF 2.0 RC

P.P.S. Managed bean class:

P.3.S. Error stacktrace:

13 years ago
JSF
Hello,

It is not possible to use ${} EL markup inside outer ${} expression. But is it possible to workaround this? What I want to do is to pass a parameter to a EL function, while the parameter itslef is not hardocoded, but is stored in a variable. I have custom fecelet EL function, and a custom tag using this function. I'm passing parameter to a tag, and want to use it as a EL function parameter, but obvoiusly this is not working this way:

page source code:

tag xhtml description
I guess there must be other way to pass in the parameter. Could you suggest something?

Thank you!
Tim
13 years ago
JSF
OK, so here is a workaround I use currently:

JSF page looks like:

Then, my bean looks like:

But this is not convenient at all... It works but I myself don't like the idea - I need to use a <h : outputText /> just to invoke the method, plus the method itself is getBlaBlaBla() instead of only blaBlaBla(). Is there a way to execute an arbitrary backing bean method from within JSF page?
13 years ago
JSF
Thanks. Yes, agree. I also had that idea, but this doesn't work for me because non of the GUI components are initialized when the constructor is executed. If I have a control binding - those variables are not yet initialized.

I also tried to use @PostConstruct - but this doesn't work either - controls are not yet initialized by the time the method is executed. Although, I've been using SessionScoped bean in this test.. I'll try the RequestScope bean + PostConstruct - maybe this makes sense.
13 years ago
JSF
Hi all,

Could someone advise me how to implement a JSF page so that some method in a certain backing bean is executed each time the page is displayed to user? Something like "on page load" action

Thanks,
Tim
13 years ago
JSF
Well, so as to close the topic... I've found what was wrong: it occurs that only ${} syntax should be used if the attribute is declared as rtexprvalue=true, which is the case for c:set's value attribute. So, finally, this works fine with JSTL 1.2 unified EL:

BTW, it even can be used outside of the <f:view>...
13 years ago
JSF
Thanks for your answers. Actually I finally found why it didn't work. I've been using a JST 1.1.2 which doesn't use the unified EL. Now I'm using JSTL 1.2, and my backing bean gets invoked, but I still don't get the desired result. The value from a backing bean property is not actually used. Given my previous example:

the value "Details for ''" is set to "title" variable. Getters getEntity() and getName() are invoked and return correct value (I've checked this in debugger).

I assume this behavior may be caused by the declaration of "value" attribute for <c:set ...> tag:



As seen here, the deferred value has Object type. Could it be the reason of this behavior? How could I overcome this and finally get my String value returned from a backing bean used in the <c:set ...> correctly? Or, if it is not the reason, why doesn't it work now?

Many thanks for your help and any ideas.

P.S. Tim, I already consider using Facelets indeed, thanks for hint
13 years ago
JSF
Hi all,

I have a simple question: what is the scope where I can use JSF EL?

The point is that I need to use a value from a backing bean in the JSTL tag even before I use <f:view>. Here is an example:


But surely it doesn't work. It results to exactly "Details for "#{detailsController.entity.name}"" in page title, #{} syntax doesn't work there. I've tried to envelope the <c:set ...> with <f:view>...</f:view> but it didn't work either. So, the question is why? Should the syntax #{} work only in some specific context?
13 years ago
JSF
Interesting... The thing I think of, is that as since JSF 2.0b supports AJAX - is there "onclick" action available in it's dataTables?
13 years ago
JSF
Hm, unfortunately I'm not an expert on CSS either. Not sure if CSS can solve this, as since what I'd like (in the ideal solution) is that an action method of a managed-bean is executed when user clicks somewhere within a table row

BTW, as of JavaScript - I'm OK with using it on a list page - is there any way to call some action method from JavaScript? Maybe it is possible to "click" on a commandButton or a commandLink from JavaScript code? Although there are questions here too:
- how to inject a JavaScript code to dataTable's rows?
- and how to find an exact button or a link?, as since there are many of them - one per row
13 years ago
JSF
Hi

You may include one XML file into another by using XML entities. I never tried this before on web.xml, but why shouldn't it work with it - after all this is an XML feature. For example, let this will be a content of "resources.xml" file (it should be available for the server's parser, thus better to put it in the same directory where your web.xml is)


And you want to include it into your web.xml. It works like this:



I tried this out on my application - it works fine indeed. Hope this helps you.
13 years ago
JSF
Hello everyone,

I'd like to know if there are any known solutions/patterns to enable "onclick" actions in the dataTable. My application has a list-like display for a selection of entities and a details page. Previously, before migration to JSF, I had an "onclik" action on each row in a table, like this:

<tr onclick="window.location='details.jsp?entity_id=${entity.entity_id}';"> ... </tr>

But with JSF I didn't yet find an ability to specify a JSF action for an "onclick" action in the dataTable. The only solution I've found so far is using a commandLink like this:

<h:commandLink value="View details..." actionListener="#{listController.selectEntity}"/>

It is a regression from user standpoint, because previously user could click anywhere within a row, but now he/she may click only this link which is not really convenient.

Currently I consider implementing my own "clickableDataTable" component, but I wonder if there are simpler solutions?

Thanks,
Tim
13 years ago
JSF
Many thanks for the answer, Tim. Indeed session scope solves my problem of data transmission between pages. Finally I'm using an utility class to set\get\remove values to\from a session. I'm removing the data from a session right after the navigation is performed - in the getter or action methods of the target request-scope bean. Although it occurs that sometimes it is even better to keep some data in the session so as to enable correct navigation when user selects "Back" in a browser - in this case all the required data is still available. In fact I store only entity IDs in a session, so I'm not afraid to overload it.

Thanks
13 years ago
JSF
Hi all,

I've "heard" that there is "page" scope for managed-beans in JSF 2.0. However, there is no such a thing in JSF 1.2. Currently I don't have any ability to upgrade, but would like to have similar functionality. So, the question is - what are the possible ways to store the data (ideally - any object) between several requests to the very same page? The need is to keep the same instance (or at least its complete state) between several requests - for example, currently I need to use some bean data in the action method, but the bean's state gets lost when a command button is clicked.

Many thanks for any ideas!

Tim.
13 years ago
JSF