Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts form being cleared in IE 6

 
Shanna Sood
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web application using struts and it works fine with IE 7, however in IE 6.0.28 I am getting null for all of the form values. Do I need to use a older version of struts or am I doing something in my JSP that is clearing the table?

My struts-config.xml:



Thanks in advance!!

-- Shanna --
[ May 20, 2008: Message edited by: Shanna Sood ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have differences between browsers, the most likely culprit is JavaScript code. Look for JavaScript code in your JSP.
 
Shanna Sood
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the suggestion! I removed all javascript calls from my web application, however it is still giving me the same problem. The application has a dynamically created list box (which is populated just fine). When you click on an option in the select box, 2 other list boxes are suppose to be populated. These boxes are not being populated in IE6 because the Action Form is returning null for the selection attribute.

Here is what my jsp looks like:



(NOTE: I had to change onclick to onklick in order to post this)

Perhaps there is an issue with the submit() and older versions of IE??

Thank you for any suggestions!

-- Shanna --

[ May 20, 2008: Message edited by: Shanna Banana ]
[ May 20, 2008: Message edited by: Shanna Banana ]
 
Joe Ess
Bartender
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shanna, please check your private messages.
 
Shanna Sood
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just realized that the value of my hidden property is being read correctly by the ActionForm, however the selection box is still being reset (null in ActionForm).

Here is my ActionForm class:

package com.sys.harps.usermanagement;
/*
* RoleForm.java
*
* Created on January 14, 2008, 2:10 PM
*/

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

/**
*
* @author ssood
* @version
*/

public class RoleForm extends org.apache.struts.action.ActionForm {

private String[] allUsers;
private String[] allRoles;
private String[] userRoles;
private String[] privileges;
private String[] rolePrivileges;
private String command;
private boolean emailOption;

public String[] getPrivileges() {
return privileges;
}

public void setPrivileges(String[] privileges) {
this.privileges = privileges;
}

public String[] getRolePrivileges() {
return rolePrivileges;
}

public void setRolePrivileges(String[] rolePrivileges) {
this.rolePrivileges = rolePrivileges;
}


public boolean getEmailOption() {
return emailOption;
}

public void setEmailOption(boolean emailOption) {
this.emailOption = emailOption;
}

/**
* @return
*/
public String[] getUserList_id() {
return allUsers;
}

/**
* @param string
*/
public void setUserList_id(String[] allUsers) {
this.allUsers = allUsers;
}

/**
* @return
*/
public String[] getRolesList_id() {
return allRoles;
}

/**
* @param string
*/
public void setRolesList_id(String[] allRoles) {
this.allRoles = allRoles;
}

/**
* @return
*/
public String[] getUserRoleList_id() {
return userRoles;
}

/**
* @param string
*/
public void setUserRoleList_id(String[] userRoles) {
this.userRoles = userRoles;
}

public String getCommand() {
return command;
}

public void setCommand(String command) {
this.command = command;
}

/**
*
*/
public RoleForm() {
super();
// TODO Auto-generated constructor stub
}

public ActionErrors validateRemove(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getUserRoleList_id() == null || getUserRoleList_id().length < 1) {
errors.add("removeUser", new ActionError("error.remove.required"));
} else if(getUserRoleList_id().length == 1 && getUserRoleList_id()[0].equals("")) {
errors.add("removeUser",new ActionError("error.invalid"));
}
return errors;
}

public ActionErrors validateAdd(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getUserList_id() == null || getUserList_id().length < 1) {
errors.add("addUser", new ActionError("error.add.required"));
} else if(getUserList_id().length == 1 && getUserList_id()[0].equals("")) {
errors.add("addUser",new ActionError("error.invalid"));
}
return errors;
}

public ActionErrors validateRemoveRole(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getRolesList_id() == null || getRolesList_id().length < 1) {
errors.add("removeRole", new ActionError("error.removeRole.required"));
} else if(getRolesList_id().length > 1) {
errors.add("removeRole", new ActionError("error.removeRole.one"));
/* Checks if selection is a predefined role, if so this cannot be removed. */
} else if(getRolesList_id()[0].equals("2")) {
errors.add("removeRole", new ActionError("error.removeRole.cannotRemove"));
}

return errors;

}

public void reset() {
allUsers = null;
userRoles = null;
allRoles = null;
}
}

Thanks again for any help!
 
Shanna Sood
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I found my problem...it turned out that just the select boxes weren't returned values to the ActionForm. This was because I was using "onclick" at my event...I guess IE 6 doesn't know what this is interms of select boxes? I changed the event to "onchange" and now it works perfectly. Yay!

Wow, 3 days of research and it was this simple, haha.

-- Shanna --
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic