public class SelectionDetails implements Serializable { private String place_interview=""; private String date_interview=""; private String interview_schedule_userid="";
public String getPlace_interview() { return place_interview; } public void setPlace_interview(String place_interview) { this.place_interview = place_interview; }
public String getDate_interview() { return date_interview; }
public void setDate_interview(String date_interview) { this.date_interview = date_interview; }
public String getInterview_schedule_userid() { return interview_schedule_userid; } public void setInterview_schedule_userid(String interview_schedule_userid) { this.interview_schedule_userid = interview_schedule_userid; } ----------------------------------------------------------------------------
then i created an array list inside my actionform something like this --------------------------------------------------------------------- private ArrayList selectionProcess=new ArrayList();
public ArrayList getSelectionProcess() { return selectionProcess; }
public void setSelectionProcess(ArrayList selectionProcess) { this.selectionProcess = selectionProcess; } ---------------------------------------------------------------------------- My action class looks like this -------------------------------
ArrayList list=selForm.getSelectionProcess(); SelectionDetails person=new SelectionDetails(); person.setPlace_interview(""); person.setDate_interview(""); person.setInterview_schedule_userid(""); selectionProcess.add(person); selForm.setSelectionProcess(selectionProcess); ---------------------------------------------------------------------------- this is my jsp page and this is what i want to iterate ------------------------------------------------------
here its fine..but when i add logic:iterate i am getting jsp exception.can anyone tell me what mistake i made.i did something like this ----------------------------------------------------------------------------
</tr> <</logic:equal> </logic:iterate> ---------------------------------------------------------------------------- can anyone tell me my mistake and how to give iterate tag..as my deadline is approaching please help me
i am getting the exception called beanutis..when i remove index property="true" and press save its fine but again while usingindex property="true"its giving following exception..can you tell me when that exception occur. the exception is javax.servlet.ServletException: BeanUtils.populate
thanking you Sanju
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
david please help me else i will loose this job....can you help me please
You're going to lose your job if I don't do your work for you? You might want to reconsider your employer if they make *my* performance a criteria for *your* position.
I don't see anything immediately obvious; it might help to post a snippet of the rendered HTML, the action code that's run on the form submit, and the configuration of the action *being submitted to*. From the limited amount of the exception trace you provide I'd guess that there's a mis-match between the form and the form of action being submitted to, but it's hard to say.
You might also try posting on the struts-user mailing list.
When posting code here please use the UBB "code" tag so it's formatted in a more-readable fashion.
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
david dont waste your time by helping me..dont do my work..i asked for help..if your reply is like this..its better you dont respond...or admit that you dont know sanju
Originally posted by sanju sreedharan: sorry david i forgot to tell you the exception
i am getting the exception called beanutis..when i remove index property="true" and press save its fine but again while usingindex property="true"its giving following exception..
Why not remove index property="true" then if it works properly once that's done? [ December 03, 2008: Message edited by: Ryan Peterson ]
Hey Sanju, in posted code snippet there is no place you are showing index property that you claimed in later reply.
Also in your action class where are you getting selectionProcess.add(person); selectionProcess object? where as you have declared it as list. So it should be as below - list.add(person); selForm.setSelectionProcess(list);
Next Can you tell me about the struts-config entry. what is the form bean name there? is it "SelectionForm" against your action mapping entry which is being used as action attributes value in your jsp form?
If all the above Question's ans is yes, then there should not be any issue as I tested with your code snippet on system. and it's working fine. Check your code properly.
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
hai subrata
thank you for the reply..is it possible to add the botton dynamically using struts...actually you can see that i have two attribte place of interview and date of interview...when i fill that and press create the same place of interview and date of interview should come again so that i can add fpr the next entry..in my case the first what i am entering is keep on repeating..any idea how to do that..
Do you mean you want to create a new button, on the current page, without submitting the form and re-rendering the entire page?
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
david
i want to know how to do it in easier way.in my existing one i can submit only one entries at a time.i want to make it for multiple entries.i want to know how to do it
If you want to create a new form input element (or group of elements) on the current page, without submitting the page and re-rendering the entire page, IMO the easiest way to do it is with JavaScript.
Another option is to submit an Ajax request to an action that uses JSP to create the same form elements and use the returned HTML as the contents of the DOM element holding the new form elements.
david i tried to do it in javascript using innerHTML but when i tried to give struts tag inside innerHTML its giving exception..is there any other way to do it in javascript or whether i can give struts tag inside innerHTML
You have to re-create the HTML emitted by the Struts tags.
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
yes david i did that i will sent you the code below this please tell me whats wrong in it... this is my java script function function addElement() { id=id+1 var x = document.getElementById("myDiv"); var ni=x.innerHTML; var newdiv = document.createElement('div'); newdiv.id=id; newdiv.innerHTML=ni; document.body.appendChild(newdiv); this is what i want to keep on adding when i press create
place_interview=""; date_interview=""; interview_schedule_userid=""; } public String getPlace_interview() { return place_interview; } public void setPlace_interview(String place_interview) { this.place_interview = place_interview; }
public String getDate_interview() { return date_interview; }
public void setDate_interview(String date_interview) { this.date_interview = date_interview; }
public String getInterview_schedule_userid() { return interview_schedule_userid; } public void setInterview_schedule_userid(String interview_schedule_userid) { this.interview_schedule_userid = interview_schedule_userid; }} ___________________________________________________________________________
this is my form class named SelectionForm.java(i created an array list to store the attribute) -------------------------------------------------------------------------- private ArrayList selectionProcess=new ArrayList();
public ArrayList getSelectionProcess() { return selectionProcess; }
public void setSelectionProcess(ArrayList selectionProcess) { this.selectionProcess = selectionProcess; } ____________________________________________________________________________
This is my Action class i just edited and sending..in case if anyone want to see my whole action class please tell me --------------------------------------------------------------------------
package com.dewa.hr.edge.requisition; public class SelectionAction extends Action { ArrayList selectionProcess=new ArrayList(); public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String target = F_SUCCESS;
Please use the UBB "code" tags when posting code; it's much easier to read.
If you're using an indexed property, the JavaScript for creating the new form elements must also create an incremented index: right now the JavaScript is just copying everything from DIV#myDiv into the new DIV.
It also appears that DIV#myDiv contains *all* of the elements since it contains the <logic:iterate...> tag, so you'll get duplicates of each row of input elements--probably not what you want.
You're also appending the copied HTML to the document body, which is almost certainly not what you want--it needs to go inside the table containing the other form elements.
These, however, are all JavaScript, DOM, and HTML issues, not Struts.
I'd suggest first getting it working without the incorrect JavaScript to isolate the BeanUtils exception.
Also, this chunk of code has redundancies--you're creating new ArrayLists unnecessarily:
Lastly, if those array lists (langs, grades, etc.) are instance properties (i.e., members of the action, not local variables in a method) this is probably bad: actions are not created per-request--like servlets there is only one instance of an action serving any request, unless you have modified (or extended) Struts, the request processor, etc. As soon as there are multiple users hitting the same action you will see non-deterministic data-oriented errors. [ December 15, 2008: Message edited by: David Newton ]
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
can you tell me with the help of code how to do it?because i am not getting idea how to do it???
thanks sanju
sanju sreedharan
Ranch Hand
Joined: Nov 25, 2008
Posts: 48
posted
0
thanks david
Atlast i solved it last week..this site is very useful.the author of the site is really appreciated