jsp - How to set values in drop down using JSTL from db -


I have already populated the ArrayList () data in the drop down using JSTL. Nominated '(a deposit db value) Trying to set price with the exception is your suggestion please thank you in advance ... !!

Servlet Attribute

  request.setAttribute ("RESULT2", lDesignation);  

JSTL Tag

  & lt; Jsp: useBean id = "userprofile" class = "com.package.dao.UserProfile" scope = "request" /> & Lt; Jsp: setProperty name = "userprofile" property = "*" /> & Lt; Strong & gt; Designation & lt; / Strong>: & lt; Select ID = "Named" name = "Name" & gt; & Lt; Option value = "desigType" & gt; Choose the designation & lt; / Option & gt; & Lt; C: forEach var = "desig" item = "$ {RESULT2}" & gt; & Lt; Option value = "$ {desig.key}" $ {desig.key == $ {userprofile.designate? 'Selected =' selected '': ''}} $ {Desig.value} & lt; / Options & gt; & Lt; / C: foreach & gt; & Lt; / Select & gt; & Lt; Br>  

Exceptions

  javax.el.PropertyNotFoundException: javax property "key" type can not be found on java.lang.String .llbnl rsoovers $ binproperties.jet (bnl rsolvar.java month 66) at javax.el. BienLarSolar $ BiennProperties.EXX $ 300 (BinelRSolver.Java Qi 343) at javax.el BANLRsolver.property (BinnelSolarWaveJava 353) .jquax on .el.BeanELResolver.getValue (BeanELResolver.java:97) org.apache.jasper.el.jasperELResolver.getValue (JasperELResolver.java:104) org.apache.el.parser. At AstValue.getValue (AstValue.java:183) at org.apache.el.ValueExpressionImpl.getValue (ValueExpressionImpl.java:184) atorg.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate (PageContextImpl.java:967) at org. Apache.jsp.home_jsp._jspx_meth_c_005fforEach_005f0 at (home_jsp.java): 510) org.apache.jsp.home_jsp._jspService (home_jsp.javaociety79) at org.apache.jasper.runtime.HttpJspBase.service (HT) tpJspBase.java: 70) .JspServlet.serviceJspFile on org.apache.jasper.servlet.JspServletWrapper.service (javax.servlet.http.HttpServlet.service (HttpServlet.java:727) on JspServletWrapper.java:432) on org.apache.jasper.servlet Or On g.apache.jasper.servlet.JspServlet.service on (JspServlet.java:390) (JspServlet.java:334) javax.servlet.http.HttpServlet.service (HttpServlet.java:727) organization. apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:303) org.apache.catalina.core.ApplicationFilterChain.doFilter on (ApplicationFilterChain.java:208) org.apache.tomcat.websocket.server.WsFilter.doFilter on ( WsFilter.java:52) on org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter (on ApplicationFilterChain.java:208) on org.apache.catalina .core.ApplicationDispatcher.invoke (ApplicationDispatc her.java:748) atorg.apache.jasper.JasperException: an exception occurred line 158 processing JSP page /home.jsp at 155: & lt; Strong> Designation & lt; / Strong>: & lt; Named ID = "named" name = "" & gt; 156: & lt; Option value = "desigType" & gt; Choose the designation & lt; / Option & gt; 157: & lt; C: forEach var = "desig" item = "$ {RESULT2}" & gt; 158: & lt; Option value = "$ {desig.key}" $ {desig.key == $ {userprofile.designate? 'Selected =' selected '': ''}} $ {Desig.value} & lt; / Options & gt; 15 9: & lt; / C: forEach & gt; 160: 161: & lt; / Select & gt; & Lt; Br> The answer is found by setting a beam value in one variable and if checked in position,  

Exotic Loop

& lt; Strong & gt; Designation & lt; / Strong>: & lt; Select ID = "Named" name = "Name" & gt; & Lt; Option value = "desigType" & gt; Choose the designation & lt; / Option & gt; & Lt; Option value = "$ {selectedDesig}" selected & gt; $ {SelectedDesig} & lt; / Options & gt; & Lt; C: forEach var = "specify" item = "$ {RESULT2}" & gt; & Lt; C: If test = "$ {designate! = SelectedDesig}" & gt; & Lt; Option value = "$ {nomate}" & gt; $ {Designate} & lt; / Options & gt; & Lt; / C: If & gt; & Lt; / C: foreach & gt; & Lt; / Select & gt; & Lt; Br>

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -