Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
When submiting driop down value its shwoing null.
pankaj semwal
Ranch Hand
Posts: 303
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi
when i am selecting any of the value from drop down box its showing null .when i print these values in action class.
Please help me.
This is my
jsp
page code
<td class="frmLable">Yrs. of Experience </td> <td class="frmField"><s:select name="upload.yer_of_exp" headerKey="" headerValue="- Select- " id="expId" list="%{experiences}" listKey="expId" listValue="description" cssClass="formText" /> </td>
myActionclass code
package com.consulting.action; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.consulting.dao.resumeDBdao; import com.consulting.vo.Experience; import com.consulting.vo.Qualification; import com.consulting.vo.State; import com.consulting.vo.Upload; import com.opensymphony.xwork2.ActionContext; public class JobApplyAction extends BaseAction { private static final long serialVersionUID = 1L; private List<State> states = new ArrayList<State>(); public List<Experience> experiences = new ArrayList<Experience>(); public List<Qualification> jobQualifications = new ArrayList<Qualification>(); static Logger log = Logger.getLogger(JobApplyAction.class); public Upload upload; private Integer[] jobYearOfExp; //add public String execute() { System.out.println("in Execute"); return "success"; } private List<Experience> prepJobExperience() { Experience experience = new Experience(); experience.setExpId(1); experience.setDescription("0-1 Year"); experiences.add(experience); experience = new Experience(); experience.setExpId(2); experience.setDescription("1-2 Years"); experiences.add(experience); return experiences; } private List<Qualification> prepQualifications() { Qualification qualification = new Qualification(); qualification.setQuliId(1); qualification.setDescription("B.E"); jobQualifications.add(qualification); qualification = new Qualification(); qualification.setQuliId(2); qualification.setDescription("MCA"); jobQualifications.add(qualification); return jobQualifications; } private List<State> prepState() { State state = new State(); state.setStateId(1); state.setStateName("Delhi"); states.add(state); state = new State(); state.setStateId(2); state.setStateName("Haryana"); states.add(state); state.setStateId(3); state.setStateName("Punjab"); states.add(state); state.setStateId(4); state.setStateName("Jaipur"); states.add(state); state.setStateId(5); state.setStateName("Banglore"); states.add(state); return states; } public List<State> getStates() { System.out.println("==State" + states); return states; } public void setStates(List<State> states) { this.states = states; } public Upload getUpload() { return upload; } public void setUpload(Upload upload) { this.upload = upload; } @Override public String save() { System.out.println("call save method"); resumeDBdao resumeDB = new resumeDBdao(); //resumeDB.save(upload); upload.setYer_of_exp(experiences); System.out.println("exprience"+upload.getYer_of_exp());; return "added"; } @Override public String add() { resumeDBdao resumeDB = new resumeDBdao(); states = resumeDB.getAllState(); experiences = resumeDB.getAllJobExp(); jobQualifications = resumeDB.getAllJobQuali(); return "add"; } @Override public String delete() { // TODO Auto-generated method stub return null; } @Override public String edit() { // TODO Auto-generated method stub return null; } @Override public String search() { // TODO Auto-generated method stub return null; } @Override public String update() { // TODO Auto-generated method stub return null; } public void setRequest(Map arg0) { // TODO Auto-generated method stub } public List<Experience> getExperiences() { return experiences; } public void setExperiences(List<Experience> experiences) { this.experiences = experiences; } public List<Qualification> getJobQualifications() { return jobQualifications; } public void setJobQualifications(List<Qualification> jobQualifications) { this.jobQualifications = jobQualifications; } public Integer[] getJobYearOfExp() { return jobYearOfExp; } public void setJobYearOfExp(Integer[] jobYearOfExp) { this.jobYearOfExp = jobYearOfExp; } }
Nishan Patel
Ranch Hand
Posts: 689
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Just remove your %{} from list="%{experiences}" and use list="experiences"
and see using this.
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD
Java Developer
,
My Blog
pankaj semwal
Ranch Hand
Posts: 303
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
HI
Now its works.But still i do not understand how its works.
<s:select name="upload.state" headerKey="" headerValue="- Select- "
id="stateId" list="states" listKey="stateId"
listValue="stateName" cssClass="formText" />
When i am trying to select state its also showing null values.
Please help.
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Not getting the variable values.
how to iterate.
How to implement?
Usage of Block
Need help in getting check box values
More...