You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Binu John <Bi...@infosys.com> on 2008/04/28 16:55:20 UTC

Struts 2 tag : Unable to retrieve the value in the action

Hi,
I am trying to use the select tag and somehow it does not work as expected.
I am populating a Map with the desired values and using that Map object in the select tag.

<----- Start JSP ----->
<s:select value="selectKeyword" theme="simple" key="selectKeyword" id="selectKeyword" name="selectKeyword" list="selectKeyword" multiple="true"></s:select>
<----- End JSP ----->

<----- Start Action Code ----->
private Map selectKeyword = new HashMap();
public void setSelectKeyword(Map selectKeyword) {
        log.debug(LoginAction.class.getName() + ": execute() : HERE AFASDFSD");
        this.selectKeyword = selectKeyword;
}
public Map getSelectKeyword() {
        return selectKeyword;
}

public String execute()
{
        selectKeyword = populateHashMap();
        return SUCCESS;
}
/* This gets called when I submit the form */
public String saveKeyword()
{
        System.out.println("This prints size as 0 : " + selectKeyword.size());
}
<----- End Action Code ----->

I am able to view the populated list box but when I try to retrieve the value back in my code, I am not getting any value.

Any idea where I am going wrong?

Binu John
Programmer Analyst,
Infosys Technologies Limited, Pune
Mobile # +919823019001


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org