Forums Register Login

Servlet Help

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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 ]
+Pie Number of slices to send: Send
"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
+Pie Number of slices to send: Send
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 got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 689 times.
Similar Threads
How to separate Business Logic from the servlet
response.sendRedirect not working
how to acces a remote servlet from a java client?????
cannot activate servlet in the Web browser
problem with response commitment
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:00:54.