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

For Loop help, checking prime numbers
Show content on only one page
Dealing random poker hands
Before advice getting executed twice…same join point listed twice for same method so it gets called twice
Animate scroll to div inside parallax site
Format a Java double by hand
Memory used and Time Taken by external process invoked using ProcessBuilder in Java
replace(“\”“, ”“") method alternative using jstl
OpenJDK on OpenShift: “NoSuchAlgorithmException: EC AlgorithmParameters not available”
Integrating Apache Shiro with Play 1.2
Creating Multiple JButtons in Swing - Neaten this code
Finding the Max max number of a set of data
Java Swing - Repaint() don't work correctly
Is it possible to clear a TextArea AWT?
Get Volume of Arbirtrary frame in Clip (Java)?
Project-Euler — Problem20

Categories

HOME
xamarin
log4j
listview
webpack
zeromq
minimum-spanning-tree
relative-path
kalman-filter
sharepoint-designer
rdf
sqlite3
blueprintjs
fingerprint
yum
onelogin
mouse
podio
kentor-authservices
floating-action-button
rascal
modelica
google-apps-marketplace
jplayer
moonmail
msp430
finite-automata
google-static-maps
reactcsstransitiongroup
undefined
code-review
conemu
clickonce
tokenize
android-widget
angular2-aot
strncpy
gitignore
objectanimator
google-cloud-nl
yadcf
create-table
serverside-rendering
sas-visual-analytics
node-sass
appcompat
youcompleteme
network-flow
revapi
promela
elgg
drupal-6
sqlbulkcopy
mediaelement
angular-strap
ado.net-entity-data-model
mikroc
skobbler-maps
mathematica-frontend
hill-climbing
netmq
pundit
ionic
streambase
lustre
pick
dd
coldbox
asp.net-dynamic-data
android-nested-fragment
internet-connection
zend-route
article
dml
jquery-layout
doskey
mbr
prettify
.aspxauth
sitemesh
ril
cos
buster.js
mhtml
cisco-jtapi
google-email-migration
broken-links
labwindows
dbproviderfactories
qt-jambi
genshi
joyent
propagation
pyinotify
mongomapper
radcombobox
wise
forums
sustainable-pace
project-hosting

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