aspose file tools*
The moose likes Servlets and the fly likes how to send an attribute to servlet via form action? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to send an attribute to servlet via form action?" Watch "how to send an attribute to servlet via form action?" New topic
Author

how to send an attribute to servlet via form action?

Rafael Prado
Ranch Hand

Joined: May 17, 2003
Posts: 33
My form goes like this:

The servlet must know if the user is logging in or out, so, besides sending the url, it should send either the 'login' word or 'logoff'.
Anyways, the problem is that neither attributes are being received by the request, which goes in this loop:

What different treatment should I give to url and acao parameters?
Paul Lester
Ranch Hand

Joined: Dec 27, 2002
Posts: 40


Should be:

Notice no single quotes and an ampersand instead of a comma.
Paul


Where Photography meets vision.<br /><a href="http://www.photogravision.com" target="_blank" rel="nofollow">http://www.photogravision.com</a><br />Please stop by!<br /> <br />SCJP,SCWCD,SCJD,SCEA
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

make them hidden fields in the form
<input type=hidden name="url" value="'principal.jsp">
Placing attributes in the action tag is poorly supported in browsers and therefore will behave differently depending on what the client is using.
Dave
Rafael Prado
Ranch Hand

Joined: May 17, 2003
Posts: 33
Thanks for the quick replies.
The url and action could be read.
Now the result is the browser completely blank.
The servlet does:

if everything goes fine and nothing more. Am I missing something?
EDIT: Checking to see if an exception is being thrown I saw it worked.
http://localhost:8080/caiu/AgComunicador
is the address shown. Shouldn't it be http://localhost:8080/caiu/principal.jsp since it was the url in redirect?
[ May 19, 2003: Message edited by: Rafael Prado ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Try using getParameter("string") rather than getParameterValues("string")[0]
Dave
Rafael Prado
Ranch Hand

Joined: May 17, 2003
Posts: 33
Not yet. I'm getting the same results.
Tried with http://localhost:8080/caiu/principal.jsp and still no luck.
Note that this url can be accessed when typed in the browser.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to send an attribute to servlet via form action?