java


pass jsp parameter to another using button


so i'm trying to pass selected value from a combobox in a jsp to another jsp here is what i got myself into
<form name="ff" method="post">
<select name='mat' id='soflow'>
<% ArrayList<Matiere> listeM = MatiereListe.GetMatiere(); %>
<option></option>
<% for (Matiere d : listeM)
{ %>
<option value= <%=d.getCode_mat() %> >
<%=d.getLib_mat() %>
</option>
<% } %>
</select>
<input type=submit value=valider />
<br>
</form>
<button onclick="window.location.href='/acceuil.jsp?mat=' JSGetSelectedItemMat() " >Statistique</button>
<script>
function JSGetSelectedItemMat()
{
var e = document.getElementById("soflow");
var strSel = e.options[e.selectedIndex].value;
document.getElementById("btt").value = strSel;
}
</script>
try this code to get selected valued from select tag. As there is no need to use js, you are using post method in your html form. Also get the value in acceuil.jsp using getParameter method. that is request.getParameter("mat");
<form action="acceuil.jsp" name="ff" method="post">
<select name='mat' id='soflow'>
<% ArrayList<Matiere> listeM = MatiereListe.GetMatiere(); %>
<option></option>
<% for (Matiere d : listeM)
{ %>
<option value= <%=d.getCode_mat() %> >
<%=d.getLib_mat() %>
</option>
<% } %>
</select>
<input type=submit value=valider />
<br>
</form>

Related Links

How to handle a web element which is reported as “NOT visible” by Selenium when clicked on, in a login page
How do I access methods within the objects I put in an array?
.getSource() returns null value on javafx
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
return different value in constructor and in the method in java
error saying my standard input is empty
Contains Method Not working HashSet Java
Java - How to use HS256 with JwtAccessTokenConverter
LeJOS Ev3: Starting a program takes very long
Hibernate Criteria with EmbeddedId not generate correct sql query
Spring boot 2.0.0.BUILD-SNAPSHOT rest: Can not override _serializer?
Can't convert object of type java.lang.Long to type com.example.or.dancers.Info
Modules in Android Studio
I cant display the output from properties file in java
HBase region - region server programmatic assignment
Resource configuration class could not be loaded when trying to open index.html in eclipse

Categories

HOME
pypi
gerrit
dictionary
office365api
read-eval-print-loop
pivotal-cloud-foundry
android-youtube-api
fancybox-3
kentor-authservices
messages
ibm-odm
lombok
opentracing
libtiff
progressive-web-apps
text-rendering
jtextfield
swingx
plunker
amazonsellercentral
autocad-plugin
jasonette
kvc
autosys
one-to-many
fopen
webkitspeechrecognition
vision
kendo-ui-grid
perlin-noise
form-data
file-format
gesture
splice
sfdc
grid.mvc
mime
angular-resource
prolog-setof
hls.js
setter
nativeapplication
diagnostics
composite-key
google-perftools
qtwebview
flow-control
gcsfuse
home-directory
adxstudio-portals
associative-array
phpcas
historian
sdhc
dukescript
appfabric-cache
notify
bridge.net
umbraco6
javax.mail
csquery
operator-precedence
ng-animate
gadt
xcode-6.2
gulp-less
marmalade
seaside
dealloc
inbox
batterylevel
mqx
ember-app-kit
android-hardware
pvrtc
newtonscript
ocx
hgsubversion
vdsp
cinema-4d
appendto
google-friend-connect
forums
thunderbird-lightning
firefox4
virtual-functions
gacutil

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App