Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

eddy johns

Ranch Hand
+ Follow
since Feb 16, 2010
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 eddy johns

Thank you, Tim. This sounds like a really good tip, I'll keep it in mind.
6 years ago
JSF
Thanks for replying, Tim. I solved my issue by using the viewId, which you can get like this:



Instead of checking the session for which page I'm on, I'm simply doing it like this.
6 years ago
JSF
Hi all,

I have a strange problem with a JSF2 application. I'll try to describe it in detail.

My home page has eight links: 5 on the header and 3 on the footer. I also have a search component which I need to show -- once the user is logged in -- for 3 of those pages. The way I'm doing it is by passing a "fromPage" attribute in the session, and making a decision to show, or hide the search component.

When I am using <h:commandLink> for all my home page links it all works fine. But another problem arises: the JSF url's are trailing by one click. This is a known issue so I wont' go into detail explaining it, but simply put when I click on "Contact Us" from the "Home" page the pages changes to the Contact Us page but in the URL I'm still on the home page. Which creates a completely unintuitive environment for the user.

So I moved all my links to <h:link>. Now the url's change every click and it behaves normally. But now all the "outcome" methods -- for all 8 links on the home page -- are called from left to write, top to bottom ON EVERY CLICK TO WHICHEVER PAGE. The url changes correctly and the page is displayed correctly but the "fromPage" attribute in the session is always for the last link called: the one at the bottom right.

To make things even more bizarre, my Search component is always showing, because the last link on the header is for one that it should show for. When I test this by putting another link on the page -- at the top right, just before the Search component -- for a page the Search shouldn't show for, the Search doesn't show. Ever. No matter which page I'm clicking to.

I can simply give up on the url's showing the correct page, switch back to commandLinks, and move on with my life. But I want to get it right, and help my users. Is there a solution?

(If this is not clear enough and you need more information please let me know!)

Thanks!

Eddy
6 years ago
JSF
Hi. I'm successfully using the method described here to catch errors in a JSF2 application. But one issue is still unresolved. When an error is thrown, I'm sending the users back to the home page. This works fine. But what I'd like to do is invalidate their session, and let them know we're having technical difficulties. Is there a way to do that?

Thanks!
6 years ago
JSF
Thanks, Tim.

I'm looking into the solution you're suggesting and I'm running into a problem.

The following code, from the tutorial on the web on this tag:

<hutputText id="txt_count" value="#{navBean.count}" />
<p:poll actionListener="#{navBean.increment}" interval="1000" update="txt_count" />

is in a

<f:view>
<h:form>

with the appropriate closing tags. But when I try to hit the page it generates a Property 'increment' not found on type com.roberts.ui.NavBean exception, and the page isn't rendered.

The increment method is there in the bean:

public void increment(ActionEvent actionEvent) {
count++;
}

What am I doing wrong? Any help would be greatly appreciated!
6 years ago
JSF
Hi all,

I'm new to JSF so excuse the newbie question.

I need to continuously update a text field with values that come from the server. The idea is similar to that of a clock, updating every one second (for example.) I was thinking I could use this tag:

<f:ajax render="serverData"/>

but with something like render-continuously, as in:

<f:ajax render-continuously="serverData"/>

but of course render-continuously doesn't exist...

So, how do you achieve this?

Thanks!

Eddy
6 years ago
JSF
Anyone? Can AJAX even do this -- display a message to the user, and change it based on server developments -- without any interaction from the user?

What I mean is, I'd like AJAX to change a text field on the site, reflecting the current work done by the server. The process itself takes several hours, and the message would need to be updated every few seconds, so that the user can sit there and see that "data for name1 is loading... data for name2 is loading" etc.. Is that possible?

Thanks!

Eddy
Hi all,

I have an application that loads data from an outside source. The process takes several hours, and I'd like to continuously update the web page with messages saying something like "data loaded for account name1, data loaded for account name2" etc. etc. In other words the server is working, and I need to send data about this work from the server to the client without them refreshing the page.

Is AJAX the way to go? Does anyone have a code sample?

Thanks!

Eddy

Actually, wouldn't AJAX solve this problem, AND give the user feedback?

Can anyone point me to a good struts / ajax tutorial, with code that continually updates the client based on a long process running on the server?
6 years ago
JSP
Thanks, Bear.
6 years ago
JSP
Eclipse & Tomcat 7.
6 years ago
JSP
OK, to be more specific, is there any way to stop the browser from timing out? Something like a struts object that keeps sending the browser a "stay alive" request of some sort?

Thanks!
Eddy
6 years ago
JSP
Hi all,

I need to have a web interface with a button click that starts a process working several hours. I assume *something* will time out before the process ends. Is there a way to overcome it?

Thanks!
6 years ago
JSP
I am using log4j with eclipse and tomcat.
7 years ago
Thanks, Shankar. Looks like it should work. But where is the log4j.xml file? And where should I put it in Eclipse?
7 years ago