java


My drop down value always showing initial value only if i select another value also keep on showing initial value in jsp


When I select to change dropdown value, it is not showing selected value. It keep on showing the initial value. Only how can I display selected value?
My dropdown :
Jsp:
<body onload="form1.submit();">
<form name="form1" action="#" >
<select id="ddl" name="ddl" onchange="submit();">
<% while (res.next()){%>
<option value="<%=res.getString("ID")%>"><%=res.getString("UserId")%><%}
String Per=request.getParameter("ddl");
out.println(Per);%>
</form>
</body>
If the form is submitted on page load, then it will do so in a endless loop. Please don't do that. Here is some demonstration code using JSTL.
<%# taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<form name="form1" action="#" >
<select id="ddl" name="ddl" onchange="submit();">
<c:forEach items='1,2,3,4,5' var="current">
<option value="${current}"
<c:if test="${current == param.ddl}">
selected
</c:if>
>${current}</option>
</c:forEach>
</select>
</form>
Selected value is ${param.ddl}
</body>
</html>

Related Links

Random number generator to array, with no duplicates java [duplicate]
An alternative to Math class for Floats
Hibernate - How do I force an Outer Join in a “not in” #Filter?
Perform String Append and Arithmetic Operations on ArrayList<String> elements
How frequently is RandomAccessFile length updated?
Spigot - Cast String to Material - Java
Better way to use HikariCP with Hibernate in Spring Boot Project
How to convert Java applications for Mac into Java applications for Windows? [closed]
Spring messageSource Doesn't work
Java PreparedStatement SQL syntax error [duplicate]
What are the differences between Math.(E|PI) and those of StrictMath?
how to print out all males with name that begin with A - C using lambda expression
Passing array to get mean median and mode in java
SVNKit java.lang.IndexOutOfBoundsException
Jsoup Select with multiple queries / Is there OR operation inside Jsoup select?
Whenever a call a function in selenium, it opens a new window and my program stucks

Categories

HOME
twitter
testing
mediawiki
deezer
view
relayjs
octobercms
spagobi
read-eval-print-loop
win32gui
node-notifier
facebook-messenger-bot
here-api
kentor-authservices
wheelnav.js
jplayer
ups
decimal
uitypeeditor
opentracing
propel
reactive-cocoa
ab-testing
visual-composer
sylius
wkwebview
claims-based-identity
trading
firebase-crash-reporting
intel-pin
compatibility
uiswipegesturerecognizer
unspecified
vapor
dynamic-reports
core-plot
fakeiteasy
mime
sas-jmp
google-datalayer
fault
pubmed
errordocument
idisposable
quartz-composer
nested-sets
medium.com
abcpdf9
vmware-tools
file-writing
google-web-starter-kit
flash-cs5
sdf
whois
pickadate
yaws
php-internals
ipconfig
javax.sound.midi
separator
r-tree
icu4j
mutation-observers
android-listview
interrupted-exception
sankey-diagram
remobjects
notify
device-orientation
ng-animate
id3v2
internet-connection
heisenbug
contenttype
poller
c18
runtime.exec
excel-2003
limejs
free-variable
funscript
propertyeditor
jspinclude
objective-c-2.0
nsdatecomponents
gnustep
psi
yetanotherforum
sql-server-profiler
fluent-interface
xsdobjectgen
nhibernate.search
audio-capture
ctp4
thread-local-storage

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile