SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    May 2001
    Location
    Canada
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very advance HTML (email javascript functions) help please (using JSP and Java beans)

    Ok, here is my situation. I am working on a big project written mostly in Java (jsp) and beans etc...
    But what I want to ask is that in one of our jsp pages (working similar as asp), I have an email (html email) sent to a user.
    In this email, there are colors and tables etc...
    There are a few links, but these links cannot be direct links because I need information to be passed into the next window WITHOUT using any cgi stuff,
    I have made a function:

    <script language='JavaScript'>
    <!--
    function requestClick()
    {
    document.listForm.userNameHD.value = originatorUsernameRequestEmail.value ;
    document.listForm.dispatchto.value = document.listForm.submitPage.value;
    document.listForm.displayMode.value = 'EDIT';
    document.listForm.submit();
    }
    //-->
    </script>

    This is what it looks in general (remember, this is in an email).
    This is when I call the method:
    Click <A HREF='javascript:requestClick()'>here</A>

    My question is, does email programs /application (such as Outlook and outlook express ) support javascript functions, if so, what am I doing wrong?
    I know im not putting double quotes, that is because I have that coded in a Worker bean.java file and I cannot use double quotes.

    Ive been working on this with a co-worker for like 5 hours....
    help please,

    Thanks
    Pierre Grandmaison
    webmaster/Application Developer
    http://www.HotgamesDownload.com
    webmaster@HotgamesDownload.com

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2000
    Location
    Palo Alto, CA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, first you can use double quotes (") in JavaBeans or JSP code, or Servlets. (Escape it...(\"))
    Then, you have almost no chance that anyone will have your JavaScript working in their
    email clients. With JavaScript you can do lots of crazy stuff, and thats why everyone disables it (or it's disabled by default) in email clients. So, it's not a solution, unless you 100% sure that all people who recieves it will have JS enabled.
    If you can tell what you are trying to do, because there is always more then one way to do it (As someone said about PERL ? ;-).
    For example you can have url.html?var=val&var2=val2 still in place, but then parse it on that final page
    with JavaScript (Yep, no CGI at all).
    John.

  3. #3
    SitePoint Member
    Join Date
    May 2001
    Location
    Canada
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    in details, what my project is... please continue helping...

    Ok, Some things worked so far, but Im still having lots of problems...
    The double quote with \ worked perfectly, thanks a lot.
    We knew already about url?blablabla&.... but thanks for the input. I'll tell you why we will need to hide it:

    We are sending emails to clients with a link going to a specific page (in their account). We hide all the information after /rms/adm because we want people to be obligated to sign in everytime they use the RMS system.

    Now, what we have is the following:
    In the worker bean, we have added
    buf.append("<FORM name='listForm' id='listForm' method='POST' action='/rms/adm'>\r\n\r\n");
    to the html sent in the email.
    and we have:
    buf.append("<input type='hidden' name='dispatchto' value=''>\r\n\r\n");
    buf.append("<input type='hidden' name='displayMode' value=''>\r\n\r\n");
    buf.append("<input type='hidden' name='submitPage' value='" + rmsLocationUrl +"email.jsp'>\r\n\r\n");
    buf.append("<input type='hidden' name='idHD' value=''>\r\n\r\n");
    buf.append("<input type='hidden' name='userNameHD' value='"+originatorUsernameRequestEmail+"'>

    So that defines the email variables (hidden), and it does work fine.
    It's when I try to pass it into the pop-up page when the user click on the link in their email that it doesn't work, cuz if I don't use my function, e.g. :
    This is the pop-up page (email.jsp):

    <body bgcolor="#000000" border="0" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

    <form name="loginForm" id="loginForm" method="Post" action="/rms/adm">
    <input type="hidden" name="actionMode" value="">
    <input type="hidden" name="displayMode" value='<%=request.getParameter("displayMode")%>'>
    <input type="hidden" name="dispatchto" value="">
    <input type="hidden" name="thisPage" value='<%=thisPageView%>'>
    <input type="hidden" name="backPage" value='<%=backPage%>'>
    <input type="hidden" name="compPage" value='<%=mngPageComp%>'>
    <input type="hidden" name="viewPage" value='<%=mngPageView%>'>

    and then , a little lower we have :
    <tr>
    <td width="50" height="15">User Id/td>
    <td height="15" width="150"><font class="loginBox"><input type="text" id="userName" name="userName" class="loginBox" value='<%=userName%>' maxlength="40" size="20"></font></td>
    </tr>

    But the value returned of inside the box is null, it is also null on the server (Sun solaris).
    So this means that the information is not being passed from the email to the pop-up,
    have any idea where we are missing something?

    Thanks
    -working from an AJC (authorized Java Center)
    Pierre Grandmaison
    webmaster/Application Developer
    http://www.HotgamesDownload.com
    webmaster@HotgamesDownload.com

  4. #4
    SitePoint Member
    Join Date
    May 2001
    Location
    Canada
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll just add a comment to what I said earlier,
    we have worked on the situation, and we are not 100% sure that functions do not work (javascript functions) inside outlook and outlook express, no matter what your settings are. We have learned this by doing several testings with our application.
    Therefore, javascripts do work, exept for functions, we will try to buil on that...
    Pierre Grandmaison
    webmaster/Application Developer
    http://www.HotgamesDownload.com
    webmaster@HotgamesDownload.com

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2000
    Location
    Palo Alto, CA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I won't give you just quick reply. right now. I'm, going for lunch, after I back, I'll look at your problem, and see what ideas i may come up with.

    - John.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2000
    Location
    Palo Alto, CA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    while im on lunch, tell me how do you submi this form from email. (js, or plain html, etc.)

  7. #7
    SitePoint Member
    Join Date
    May 2001
    Location
    Canada
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok
    The email is normal HTML email that users see in Outlook (it's is an intranet thing so it doesn't matter if it works with other programs or not).

    ok, I am sure 100% that javascript functions don't work in html email. However, javascript does work.

    Now, this form calls another page when the user clicks the "Click here" button inside the html email.

    When the user does that, a page opens and it is http://ouripaddress:8080/rms/adm/(the rest of the url here is hidden to the user using input type=hidden).

    In the email, we have hidden variables such as the user ID. This information is kept as input type hidden etc...

    Here is what works: making the click here link :http://ouripaddress:8080/rms/adm?user=theuserName&requestId=requestId

    the userName and requestId variables are defined in the hidden part of the email.

    so that way the link works and everything works on the pop up page.

    The information being passed (userName and request Id) is displayed in text boxes in the pop up.

    But we want ?user=theuserName&requestId=requestId
    to be hidden to the user (the link and also in the address bar of the pop up) so that they will not be able to access it manually from anywhere exept by clicking in their email.

    P.s. The pop up is a .jsp page.

    Do you have any solutions?
    Pierre Grandmaison
    webmaster/Application Developer
    http://www.HotgamesDownload.com
    webmaster@HotgamesDownload.com

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2000
    Location
    Palo Alto, CA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok gotcha.
    try to use same form, with hidden vars. But make link like
    <a href="javasciprt:formNameHere.submit();">Click Here</a>
    make sure the method="POST" action="/whatever/page.jsp" like

    PHP Code:
    <form name="formNameHere" action="/whatever/page.jsp" method="POST">
    <
    hidden fields="here">
    </
    form>
    <
    a href="javascript:formNameHere.submit();">Click Here</a
    (Above its javascript as one word of course. Seems this PHP processor
    screws it... (???)

    It should work just fine.
    Also, anyone can see the source code of email anyway... unless
    you sending it to people who arent tech type.

  9. #9
    SitePoint Member
    Join Date
    May 2001
    Location
    Canada
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks for all your help.
    The last peace of code you wrote, I wrote it down. We got it to work another way (which is not totally unhackable), but it's still pretty secure.)

    I will probably try to implement the code you wrote in version 1.2 or somethign like that because we need to have something very soon and we have still lots of work to do with version 1.0.

    Thanks again,
    Pierre Grandmaison
    webmaster/Application Developer
    http://www.HotgamesDownload.com
    webmaster@HotgamesDownload.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •