Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Can we pass parameters to login.jsp in Tomcat Form-Based authentication

Thread Tools

Can we pass parameters to login.jsp in Tomcat Form-Based authentication

Posts: n/a
I have a web-application (WebApp_1) running on Tomcat.
The security is Tomcat Container-managed security --
it is FORM-based. The login page is a servlet,


Two types of users can access my application.
And depending on that, I want to provide appropriate
login pages say
http://<ipaddress>/englishLogin.jsp and

When I access either of these pages, Tomcat invokes

The question is:
When I am in /servlet/loginHandler servlet, I don't
know which URI was accessed. So, while in the
loginHandler servlet how do I access the information
related to the actual URL sent by the browser
(englishLogin.jsp or spanishLogin.jsp)

I'd appreciate any help in this regard.

P.S. I tried adding custom information in HTTP header
so that I can use that information in loginHandler but
that is not a feasible solution.

Reply With Quote
Posts: n/a
You can get the URL or URI from the HttpServletRequest object.

Reply With Quote
Posts: n/a
> You can get the URL or URI from the HttpServletRequest object.

Thanks for your response.

getRequestURL and getRequestURI return the following
respectively when invoked from loginHandler. (URL)

/servlet/loginHandler (URI)

But what I want to access is the original URL (of a protected
resource, say spanishLogin.jsp).

It appears that Tomcat has exclusive access to the original
URI in this case and it is not accessible from a program.

Is this correct?

Reply With Quote
Posts: n/a
Ok so you should just use a hidden input that called language and set
it respectively on the page the user hits. Then on the submit you can
parse it as a request parameter.
<input type="hidden" name="language" value="" />

where value is either "spanish" or "english"

in the servlet just do this

String language = request.getParameter( "language" );

Won't that do it?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to pass GET parameters from apache to tomcat Java 1 10-09-2007 03:42 PM
[Tomcat] How to pass application specific parameters to the JVM? Sven Jacobs Java 3 02-20-2006 09:29 AM
HOWTO: Make Reports that can pass parameters at Run-time? :: ASP.NET + CR.NET Don Wash ASP .Net 4 07-29-2004 12:58 PM
pass parameters as the page name rather than as a query string (tomcat) Austin Java 8 11-18-2003 01:32 PM
Q: How can I pass UDTs into optional parameters in VB 6.0 ? Ramesh MCSD 3 10-22-2003 06:22 PM