JSP form submission URL with parameters -


i working plain jsp (jsf not option) on web application. in jsp file, have table, , in each row display each student. also, in each row want have "edit" button, redirect page can edit student, , delete it.

so far, think best think put submittable form button inside in each row.

<table border="1">     <tr>         <th>name</th>         <th>lastname</th>         <th>send message</th>         <th>erase</th>     </tr>     <c:foreach items="${students}" var="bean">         <tr>             <td>${bean.name }</td>             <td>${bean.lastname }</td>             <td><input type="button" name="edit" value="do!"                 onclick="foo();" /></td>             <td><form action="<%="editstudent?studentid=6" %>"><input type="submit" value="edit" /></form></td>         </tr>     </c:foreach> </table> 

the form submission url test, hence hardcoded "6" parameter student id. however, when press button, redirected page url "http://localhost:8080/jspproj/editstudent?", can see ay text after question mark ignored! if remove question mark, url redirect works (but there no way pass parameter want next servlet).

can give me insight why happens?

ps. tried el, , same thing happens.

first, should specify method=get or method=post. that's nitpicking on part. problem this: not put ? , parameters in action url. put parameters in input tags.

<form action='editstudent'> <input type='hidden' name='studentid' id='studentid' value='6' /> <input type='submit' value='edit' /> </form> 

edit: vs post isn't nitpicking. kinda flipant of me that. matters. default browser treat means parameters visible in address bar , can changed unsophisticated of users. post @ least requires bit more sophistication monkey with. although, obviously, shouldn't rely on publicly viewable html security.

input type='hidden' doesn't mean user can't see if view source, obviously, no textbox put there.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -