File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Help" Watch "Servlet Help" New topic
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: 60986
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60986
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Help