File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes passing parameter from jsp view page tp jsp edit page (crud) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "passing parameter from jsp view page tp jsp edit page (crud)" Watch "passing parameter from jsp view page tp jsp edit page (crud)" New topic
Author

passing parameter from jsp view page tp jsp edit page (crud)

fred kitu
Greenhorn

Joined: Apr 02, 2013
Posts: 5
i can generate users from database to a view page
how do i pass the contact.getID value to a jsp edit page so it can populate that user to allow me to edit

here is my code


displaycontacts.jsp


[/code]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

Firstly, you should be submitting to a servlet, not another JSP, with the id as a request param. The servlet can retrieve the info and forward to the JSP with the data in request scope.

Secondly, putting Java code in a JSP is a bad practice that has been obsolete and discredited for over 12 years.

One of the (very many) good reasons for that is a problem you have in your code that you probably don't even realize: it's not thread safe! As soon as more than one person tries to use your app, it will break, and it will break badly.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
fred kitu
Greenhorn

Joined: Apr 02, 2013
Posts: 5
thanks bear
im just now taking webapp class and i will rem that
do you have a sample servlet code i can refer to?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

Servlet examples will be all over the net!

If you must use Java scriptlets for your class (why scriptlets are being taught 12 years after their obsolescence is beyond me) always avoid using the <%! %> construct. It's nothing but trouble and certainly not needed here.

But if you can eliminate scriptlets entirely, that's even better!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: passing parameter from jsp view page tp jsp edit page (crud)
 
Similar Threads
hide email and password on contactus jsp
How to fill select list from database table
exception while running code
How to invoke a method when back button in browser is clicked.
utf-8 data with get method not working but post method working.