Ilari Moilanen

Ranch Hand
+ Follow
since Apr 15, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ilari Moilanen

Why would you post a totally unrelated question to a topic that is THREE (almost four) years old? How can you possibly expect someone to answer you?
9 years ago
JSF

ashwani sinha wrote:
In my case, page have lots of requests that I want to retained in new page. could you please elaborate more on how to access the original values.
- thanks in advance.


I still use only JSF 2 so I do not know how this would work with JSF 1 but for example I use the temporay storage called Flash.
In the first action I use

and then in the receiving side in xhtml I use

and then in java code inside the loadDefaultValues method I get the contents with


Or if I just want to give simple parameters to receiving side I might use something like this (remove the blanks after & sign)

and then in the xhtml I use them with

These are maybe not optimized versions and there probably are easier ways of course...
10 years ago
JSF
Check whether controller is null or whether getKelompokBiayaJpaController() method returns null. Based on your error message (I presume that you showed the root cause correctly) the controller object is null. So you have to find out why either MasterBiyanMbean is not present or why fetching the object does not work. Very basic stuff (null checks and all).
13 years ago
JSF
Saurabh Saxen,

alas I do not have an example. All I have is code in production use.

But there should be nothing complicated in using the custom validator. As I said above I use JSF 2 (MyFaces) and the above code works as is. I do NOT have anything in the config file(s) since the @FacesValidator annotation above is enough. The validate method throws javax.faces.validator.ValidatorException if the validation fails. You can google the different classes used to find what their API says about them.

I do not use the validator programmatically anywhere, I just tested it because the original poster said that his code does not work. Instead I use the validator in UI like this:

(where t: is defined as xmlns:t="http://myfaces.apache.org/tomahawk")
13 years ago
JSF
This is a very common exception and is thrown when you try to use a view that has already expired (expiration depends on many factors).
We need more information of your situation. When exactly are you getting this exception etc
13 years ago
JSF
Allright. This is how I do it. Not my own code so I can not take credit for it and alas I do not remember where I got it. Additionally there might be a better solution (JSF based for example) since this uses basic JDK API.

I have a helper class called LocaleHelper and inside it these two methods:

And you can use it for example with a call like this:

I can explain it further but I think it should be pretty obvious what it does. It uses basic java API as I explained so all the classes there are from java.util package or from java.text package
13 years ago
JSF
Good to hear.

But in the long run (if you continue to make more complex applications etc) you should do as bajrang asthana suggested and set the values once and use the from there on (using the @postconstruct or some other way). It is not very efficient to always run the for loop (or do any other kind of complex logic) in the setters/getters since internally JSF may call the setters and getters multiple times during the execution. I have seen this behaviour when I have put logging inside a getter (or setter) and a getter may be called as many as ten times altough the value is used only once on page. I do not know the reason for that but since getters/setters should not contain complex logic the multiple calls do not affect performance normally.
13 years ago
JSF
For some reason you changed the xhtml/jsp instead of java code

Just use
and
13 years ago
JSF
argh, I do not have my code here so I can not check how I do it but I will answer tomorrow morning if someone else has not already told you how by then
BTW, do you use JSF 1 or JSF 2?
13 years ago
JSF
My original reply applies. You did not even test it? Why?

I know you do not have a property called welcome but it does not matter. JSF expects to find a property and by normal java conventions you access properties via their setters and getters.
13 years ago
JSF
JSF expects that you use the proper naming convention. The property name is "welcome" so the getter should be named "getWelcome()" instead of just "welcome()".
13 years ago
JSF
JSF
Without any info of your setup this is almost impossible to solve.
Show at least your web.xml and faces-config.xml files to us
13 years ago
JSF
I am not familiar with richfaces but it seems that you are following somekind of example. Can you show this example to us?

Also, where do you define that your class (called "sorting") is used?
13 years ago
JSF
Why the values of the dropdown boxes change to their default values? Have you checked if this behavior occurs even id you do not disable them? If I remember correctly disabled inputs DO NOT send their data to server. So your logic is faulty there. Have you tried readonly (instead of disabled) or similar?

As for how to disable input after the reload I have done something similar (not with JQuery though) and I just do what I have to do (with javascript) when the page has been loaded. I know that it is not a perfect solution but it works in my particular needs.
Something like this:

(where the init() is a javascript funtion that can for example disable those dropdown boxes after the reload etc.)
13 years ago
JSF