Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto submit form using jsp

Status
Not open for further replies.

jcaulder

Programmer
Apr 22, 2002
241
US
I am trying to integrate a vendor provided website with our internal application. My basic problem is that I want to pass login information from our internal application to the jsp login page in the vendor website.

The vendor's original jsp login page does some initial setup work so I don't want to completely alleviate it, I just want to automatically pass the username and password into the form and then auto submit it.

Currently what I'm doing is dynamically setting the 'VALUE' of the form's username and password fields to match the known username and password from our internal app.

So once those values are set, how can I submit the form as if the user clicked the submit button. I've looked at 'forward' but can't seem to get it to work right. The only examples I can find of this use a format of &quot;<jsp:forward. . .&quot; instead of a format already enclosed in jsp <% %> tags.

Thanks for any suggestions. If there is an easier way, I'd love to hear it!

Jonathan
 
How are you setting the values then? R U using javascript or just passing them as if they were parameters to the script to make it act like a failed log in?

The only way you can submit the form properly asfaik is to use javascript document.form.submit(); embedded somewhere in the page. You can probably do something like this:

...
<%
//.. code to set up log in stuff ..%>
<jsp:include page=&quot;theirloginpage.xxx&quot;>
<!-- log in parameters and wotnot -->
</jsp:include>
<script language=&quot;javascript&quot;>
document.loginFormName.submit();
</script>
...

Unless I've completely misconstrued what you want that is :)

hope this helps a bit ..


matt
 
Nope, you understood what I was looking for. I've got that part working but I've got one other problem.

Basically how I did it was to pass a username as a part of the url. I then use jsp to get the parameter and use that to autopopulate the VALUE=&quot;&quot; of the username in the form. At the bottom of the html page, after the variable have been autopopulated into the form, I use javascript to submit the form. This is all working. The last part I have to do is select the password of this specific username from a SQL Server database.

I am having great difficulty in finding anything related to connecting from jsp to SQL Server. All examples are for mySQL. I know it would be almost identical I just have to figure out what the driver name is for sql server. If you know of a good example using a sql server connection, I'd love to see it.

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top