vive shar

Greenhorn
+ Follow
since Sep 27, 2007
Merit badge: grant badges
For More
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 vive shar

hi,

could any one please let me know how to do Integration of ICEfaces with JSF?

Thanks a lot,
Vivek
16 years ago
JSF
hi,

could any one please let me know how to do Integration of ILog with JSF?

Thanks a lot,
Vivek
16 years ago
JSF
Hi All,

Is it possible to integrate ILog with JSF. If yes please let me know how? or please provide me some important links.

Many Thanks,
Vivek
Is it possible to integrate JSF with ICEfaces ? If yes please let me know how?
Small modification as per your requirement you need to have a counter variable also. I can not run code on my m/c please test the following logic.

for(int i = 0; i < v.size(); i++){
vote = (Vote)v.get(i);
int count = 0;
// inner for loop
for(int j = 0; j < v.size(); j++){
voteTemp = (Vote)v.get(j);
//As you are using Vote class Compare
//the appropriate method here.
if (voteTemp == vote ){
count++;
}
if (count>1){
errors.add("Duplicate Value");
break;
}
}
}

Thanks,
Vivek
16 years ago

Originally posted by majid nakit:
Hi,

I need to do validation in the actionForm, I want evoid duplication of user inputs :


public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();

List v = getVotes();
Vote vote;
for(int i = 0; i < v.size(); i++){
vote = (Vote)v.get(i);
in this for loop vote.getVote() bring all the input from textfields , how to test if these inputs are not duplicated
// if duplication
// errors.add(.....);
}


}
request.setAttribute("voteList", this.getVotes());
return errors;
}

Thanks, your help is appreciated.



You need two for loops here:

for(int i = 0; i < v.size(); i++){
vote = (Vote)v.get(i);
// inner for loop
for(int j = 0; j < v.size(); j++){
voteTemp = (Vote)v.get(j);
//As you are using Vote class Compare
//the appropriate method here.
if (voteTemp == vote){
errors.add("Duplicate Value");
break;
}
}
}
you can also create a function like checkDuplication and inner for loop code can be given there,you need to call that function only. that would be more cleaner code and reusable.

Thanks,
Vivek
16 years ago
Hello Anitha,

This is the behaviour of browser, if you hit refresh the button of browser exaclty previous action is repeated. Means, your page will be submitted with the same previous values you entered.So, whatever is happening is absolutely correct. So, in place of hitting refresh button put new values for login and click submit button.

Thanks,
Vivek
16 years ago
Hello Anjali,

The only thing i can guess, please make sure the very first line in config or web.xml should not be blank. The contents should start with the very first line.

Thanks,
Vivek
16 years ago
Hello Nishita,

The best approach depends upon your requirement. If first name, last name etc you are entering through jsp pages, you are doing validations and displaying differenct messages. Then second approach is better else first.

Thanks,
Vivek
16 years ago
hi,

First see the example of ApplicationResource.properties :
# Sample ResourceBundle properties file
errors.header=<h4>Validation Error(s)</h4><ul>
errors.footer=</ul><hr>

error.lastName=<li>Enter your last name
error.address=<li>Enter your address
error.age=<li>Enter your age

The major advantage of this file is if your client says to change the text like in place of 'Enter your last name' to 'Last Name' you need to change at one place and you need not make any changes in the code.Suppose many jsps are using this so one place change will reflect everywhere. But if you hard code 'Enter your last name' on the jsp pages. On all the jsp pages you will have to make changes.

For your second question Please check out the following link.
http://www.javapassion.com/handsonlabs/strutsbasics/

Thanks,
Vivek
16 years ago
hi,

I think i can help you here.Suppose a user wants to see his account details and your rule says he must login to the system. Without logging in if he tries to see his account details he should be thrown exception or message.Now suppose accessing your ejbs a hacker passes anyone's account no.As there is no validation in your ejb, ejb's will interect with the system and will give the details to the hackers. Hence it is required to do validation on ejb layer also,so that if user has not logged in he should not be able to access his account.

In true sense validation must be done on the both the layers: web layer as well as ejb layer.As per my understanding your senior does not want the same repeatative code on both the layer, hence he wants to do it on ejb layer only because it will take care both scenarios: if user comes through web layer or if he directly uses ejbs.

Thanks,
vivek
16 years ago
Hi,

If you don't want to use form bean object. You can create a hidden field and a js function. The js function will be called when you change the options in the dropdown.This js function will do two tasks.

1. Set the hidden field value to the selected value
2. submit the form.
3. get the value in the action using request.getParameter

Will this help to meet your requirement?

Thanks,
Vivek
16 years ago
Hi!!!

Are you not using form bean for this?

Regards,
Vivek
16 years ago
You need to make two entries
<servlet>
<servlet-name>product</servlet-name>
<servlet-class>com.product</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>product</servlet-name>
<url-pattern>/xyz/*</url-pattern>
</servlet-mapping>

Thanks,
Vivek
16 years ago
could you please exlain it more. Are you using servlet or jsp? could you please give the complete stack trace?

Regards,
Vivek
16 years ago