Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 03-04-2011, 07:37 PM   #1 (permalink)
Wise Old Owl
 
speedyguy's Avatar
 
Join Date: Aug 2004
Location: Bangalore/Jamshedpur
Posts: 1,173
Default Help: passing javascript variable to other html


Consider the following code in jsp where im validating a login and password:::

-----------------------------------------------------------------------
<body bgcolor="grey">
<h1> WELCOME TO XYZ</h1>




<%
String usr2=request.getParameter("username");
String pwd2=request.getParameter("pwd");
String sel2=request.getParameter("sel");

Class.forName("com.ibm.db2.jcc.DB2Driver").newInst ance();
Connection con=DriverManager.getConnection("jdbc:db2://localhost:50000/DBName","username","password");
String sql="SELECT id from login where id='"+usr2+"' and pwd='"+pwd2+"' and typ='"+sel2+"'";
Statement st=con.createStatement();
ResultSet rs= st.executeQuery(sql);
String str;
if (rs.next())
{
str=rs.getString(1);
out.println("Succesfully Logged in as " + str);
%>
<a href="home.html"> Click here to continue...</a>
<%
}
else
out.println("Invalid User ID/Password. Please go back and try again.");

rs.close();
rs=null;
st.close();
st=null;
con.close();

%>



</body>

--------------------------------------------------------------------------

Now upon successful validation i need to goto to next html page which depends on login type and id. so i need some parameters like "usr2" and "sel2" to pass on 2 next page (using href as given above) and depending on it different pages would open. Can anyone tell me how do i do that?
Sorry, newbie to scripting and html..

Thanks.

Enjoy~!
__________________
No Pain...No Gain
speedyguy is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Reply

Bookmarks

Thread Tools
Display Modes

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 On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2