#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0

    Replacing Javascript with JSP??


    As with many of the posts to this board, this is rather urgent.

    In a home page, I currently have the following:

    ---------------------------------
    <a href = "javascript:document.mainForm.submit()">Log in to portal</a> <form action="file1.jsp" method="POST" NAME="mainForm">
    <input type=hidden name=USER value=guest>
    <input type=hidden name=PASSWORD value=guest >
    <input type=hidden value=/file2.jsp name=target>
    ---------------------------------

    As with any HTML or Javacript code, this will obviously be available to anyone who viewed the soure.

    What I am looking for, is to somehow have the functionality in the code above, which is essentially posting to a form with hidden variables, replaced with something that won't be viewable by the user. My guess is that I can do some server side coding, but I can place my finger on what to do.

    Thanks,

    Alex
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Iassy - Romania
    Posts
    2
    Rep Power
    0

    Unhappy here is an Idea!


    My guess is that you wanna pass the username and ???password from one jsp to another! Instead of doing this, issue a cookie after the user has been authenticated and use the cookie to store/retrieve the username. You won't need to check for the password since the simple presence of the cookie means that the user has already entered the right password.
    Anyway, this is my idea!
    Peter.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0
    Thanks for the quickly reply.

    The problem I can see with that though, is that the user will not be authenticated at that point. I am actually using the code in my earlier message to authenticate a user as "guest" with a "password" of guest". I just can't figure out how to hard code that information so users can't see the user name and password, and privately pass that information to my authentication file2.jsp page.

    - Alex
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Iassy - Romania
    Posts
    2
    Rep Power
    0

    Hmm...


    My guess is that you want to pass "user=guest" and "password=guest" as some king of default username and password to the file1.jsp then in file1.jsp push a form to the user and data from that form submited to the second jsp (file2.jsp)
    One of the ideas that comes into my mind is:
    Use names less conspicuous like
    name=USER
    name=PASSWORD
    and do a little bit of encoding when it comes to values
    like:
    name=xpw value=dhfjkh instead name=USER value="guest"
    and in the jsp decode the values
    Peter.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    fremont,CA,USA
    Posts
    1
    Rep Power
    0
    Why not try using session variables as is being done in ASP?Is this feature supported in JSP?
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    3
    Rep Power
    0
    Do you have any coded expample of how this is done in ASP. This particular web server is running IIS so I would be able to use it.

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo