| Author |
Servlet Help
|
Ben Murphy
Greenhorn
Joined: May 18, 2005
Posts: 2
|
|
OK I am new and am still learning so if you have any tips or suggestions please tell me THis is what I currently have what I would like to do is find a way to send this to /wifi_menu without having all the stuff on the end of the URL. I have tried using a dispatcher but it would never send the name /wifi_menu would never even see the attribute there. I am doing this with the extra at the end of the url many times in other places and I really do not like it. THank you in advance Ben [ May 18, 2005: Message edited by: Ben ] [ May 19, 2005: Message edited by: Ben ]
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Tips: - Use MVC Model 2 architecture. Or atleast use servlet as a controller and JSp as a view. - Dont mess your JDBC code up with your servlet. Servlet should only care about request/response mechanism. Answer would be: you can bind your attributes with your request object, using request.setAttribute(name, value). Cheers.
|
 |
Ben Murphy
Greenhorn
Joined: May 18, 2005
Posts: 2
|
|
Originally posted by Adeel Ansari: Tips: - Use MVC Model 2 architecture. Or atleast use servlet as a controller and JSp as a view. - Dont mess your JDBC code up with your servlet. Servlet should only care about request/response mechanism. Answer would be: you can bind your attributes with your request object, using request.setAttribute(name, value). Cheers.
I have absolutely no idea what Use MVC Model 2 architecture is. I have actually never used JSP's I have tried to do request.setAttribute(name,value) but it does not work. Well I actually tried request.setAttribute("name",name) where the second name is actually a string with there name. I then tried to do a dispatcher.forward(request,response) and on the wifi_menu servlet the only parameter it gets is nxsid Is this wrong? [ May 19, 2005: Message edited by: Ben ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56540
|
|
"Ben", There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear Forum Bartender
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56540
|
|
|
If you want to chain to a new resource within the same request (so that request-scoped attributes are available in the second resource) you need to use a dispatcher and perform a forward operation. A redirect will always create a new request and any request attributes will be reclaimed when the first request goes out of scope.
|
 |
 |
|
|
subject: Servlet Help
|
|
|