On Tue, 16 Mar 2004 as as wrote : >Hi, >Try my snippet below >I populated my jsp/form bean with values from database (dynamic) > ><td> > ><% > >java.util.List driversList = (java.util.List)request.getAttribute("drivers"); > > > > > >%> > > > > > > Can i know what fullName,supervisor,supervisors ,employeeID i fpossible pl. send cation ,actionform class...thanx alot strutsguy
><select name="fullName" style="width:225px"> > ><logic:iterate id="supervisor" name="supervisors"> <option value="<bean:write >name="supervisor" property ="employeeID"/>"> > ><bean:write name="supervisor" property ="fullName"/> > ></option> > ></logic:iterate> > ></select> > ></td> > > >ddd ddd <[EMAIL PROTECTED]> wrote: > >Hi All > >I am new bie and learning to populate the drop box by all different ways . > >1. By Collections of strings >2. By collections beans >3. Hard coding >I am unable to achieve even first way tried a lot but failed can any body suggest me >where I am wrong. Also pl. suggest me how the “collection of beans” will be coded . >any body has simple java nd jsp code please Post me > > >Manay many thanks > > >Regrds >StrutsGuy >[EMAIL PROTECTED] > > >Below is Jps ,stutsconfig and java files and errors of browser . > > > > > > > > > > > >LOGIN PAGE > > > > > > >LOGIN ID > >PASSWORD > > > > > > > > > > > > >import org.apache.struts.action.ActionError; >import org.apache.struts.action.ActionErrors; >import org.apache.struts.action.Action; >import org.apache.struts.action.ActionForward; >import org.apache.struts.action.ActionMapping; >import org.apache.struts.action.ActionForm; >import org.apache.commons.beanutils.BeanUtils; >import javax.servlet.http.HttpServletRequest; >import javax.servlet.http.HttpServletResponse; >import java.util.*; >import javax.servlet.jsp.PageContext; > >// use The seSSion stuf >public class StudentAction extends Action >{ >public ActionForward execute( ActionMapping map,ActionForm form, HttpServletRequest >req , HttpServletResponse res) throws Exception >{ >String action = req.getParameter("action"); >if (action == null) >{ >StudentDatabase stBase = new StudentDatabase (); >StudentForm sf= new StudentForm(); >String[] str = stBase.getAllNames(); >String strng ="blah" ; >sf.setPasswd(strng); >req.setAttribute("sf", sf); >ActionErrors er= new ActionErrors(); >er.add(ActionErrors.GLOBAL_ERROR , new ActionError("errorRakesh")); >if(!er.empty()) >{ >saveErrors(req,er); >return(map.findForward("RakyError")); >} >else >return(map.findForward("RakyCancel")); >} >else >{ >return(map.findForward("RakyCancel")); >} > >}// end of class >} > >import org.apache.struts.action.ActionForm; >import org.apache.struts.action.ActionMapping; >import javax.servlet.http.HttpServletRequest; >import org.apache.struts.action.ActionErrors; >import org.apache.struts.action.*; >import org.apache.struts.validator.ValidatorForm; > >public class StudentForm extends ValidatorForm >{ >private int student =0; >private String passwd = null; >public StudentForm() >{ >student=0; >passwd = new String(); >} >public StudentForm( int student ,String passwd) >{ >student=student; >passwd= passwd; >} >public int getStudent() >{ >return this.student; >} >public void setStudent(int student) >{ >this.student=student; >} > >public String getPasswd( ) >{ >return this.passwd; >} >public void setPasswd(String passwd) >{ >this.passwd=passwd; >} >public void reset(ActionMapping mapping ,HttpServletRequest request) >{ >this.student=0; >this.passwd=null; >} >public ActionErrors validate( ActionMapping map,HttpServletRequest req) >{ >ActionErrors errors=super.validate(map,req); >if(student == 0) >{ >System.out.println("HELLO blah "+student); >errors.add("student", new ActionError("IDProblem")); >} >return errors; >} // end of action errors >}// end of Student from class > > > >"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" >"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"> > > > > > > > > > > > > > > > > > > > > > > > > >propertyInfo.properties >hello=This is test page >start=This is first page of the application >info=This page stores contains text files and drop downs >error=There is problem please have a look >submit=ADD TO DATABASE >clear=Clear the Data >cancel=Cancel Button >click=Please Click to start the application >button=Login >cancel=CancelButton >reset=ResetButton >IDProblem=There is problem in id has greater value than 4 pl. recheck it >prompt.username= Please Enter the User Name by blah >prompt.password=Please enter the password by bla >errors.required={0} is required. >errors.minlength={0} cannot be less than {1} characters. >errors.maxlength={0} cannot be greater than {2} characters. >errors.invalid={0} is invalid. >errors.byte={0} must be an byte. >errors.short={0} must be an short. >errors.integer={0} must be an integer. >errors.long={0} must be an long. >errors.float={0} must be an float. >errors.double={0} must be an double. >errors.date={0} is not a date. >errors.range={0} is not in the range {1} through {2}. >errors.creditcard={0} is not a valid credit card number. >errors.email={0} is an invalid e-mail address. >rakeshErROR=This is first ssuccessfyl errro by blah >errorRakesh=This is type of error in jsp page > > >eError is > >HTTP Status 500 - >________________________________________ >type Exception report >message >description The server encountered an internal error () that prevented it from >fulfilling this request. >exception >org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] >at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254) >at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) >at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) >at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >at >org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) >at >org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) >at >org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356) >at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1014) >at >org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:961) >at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:544) >at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:252) >at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) >at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492) >at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) >at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >at >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) >at >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) >at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) >at >org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) >at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) >at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) >at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) >at >org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) >at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) >at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) >at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416) >at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) >at >org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline > > >Do you Yahoo!? >Yahoo! Mail - More reliable, more storage, less spam