• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending data to jsp

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%@page language="java" %>
<HTML>
<BODY>
Hello! Enter stuff and press Log in
<FORM METHOD="POST" ACTION="test.jsp">
<TABLE>
<TR><TD>User name: <INPUT TYPE="TEXT" NAME="username">
<TR><TD> Password: <INPUT TYPE="PASSWORD" NAME="password">
<TR><TH><INPUT TYPE="SUBMIT" VALUE="Log In">
</TABLE>
</FORM>
</HTML>
</BODY>
-----------------------------------------------the login page---
How would I modify the login page so that based on the input it post the data to different pages?
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can change the forms action attribute using javascript.

Your submit button:

(remove the _ from on_click)
Your java script method:
 
Leonardo Pjetri
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


(remove the _ from on_click)


remove what with what?
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove the underscore from the word "on_click" in the code he wrote so that it becomes a single word.
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javascript is not the best way to check for conditions and redirect to different page. use MVC pattern. From a jsp, redirect to a servlet and check for conditions there. Do all the business logic in the servlet and then redirect back to a jsp based on the condition.
This way, you never have to modify the jsp again. Just keep changing the business logic in servlet whenever required.
reply
    Bookmark Topic Watch Topic
  • New Topic