• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

form email value

Hello ...
Really simple question.
I don't code in jsp but need to provide a line of code to an affiliate - and instead of searching I thought I'd post here.

On a .jspa page there will be form.fieldnames & values available.

I need to send form.email to a remote url and so the link would look like
page.cfm?email=form.email

In jsp, how do I write this?
Meaning is there a character(s) around it or ???

Yes, this question is as simple as it appears.
0
dgrafx
Asked:
dgrafx
  • 8
  • 7
  • 4
  • +1
1 Solution
 
bloodredsunCommented:
0
 
dgrafxAuthor Commented:
OK - not in that sense.
It's so simple I have trouble explaining it.

How do I say that "form.email" is the value of the variable form.email?
Like is it %form.email% or something.
What character is used in jsp?
0
 
fargoCommented:
May be you can make use of hidden values and javascript

<script>
      function update(){
         document.formname.email.value=document.emailformname.email.value;
        document.formname.submit();
      }
</script>

// this is another form with hidden field
<form name="emailformname" method="post" action="http://yoursite.com/page.cfm">
<input type="hidden" name="email"/>
</form>

Hope it helps.
fargo
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
fargoCommented:
forgot to say, when u click on the link u have to make use of onclick event.
 <a href="#" onclick="update();">Click me</a>
0
 
fargoCommented:
i don't think my post will work...forget it!
0
 
dgrafxAuthor Commented:
OK - Let me try again.
I don't need help with how to build a link or javascript.
I don't need help with how to send the email value back to us.
I just don't know jsp and I don't have time to learn.

I need to know how to say that this text "form.email" evaluates to "someone@adomain.com" and is not just text - it is a variable.
What is the character used to say "this is a variable value"?

You're thinking above what I need - this is something a person would learn the first day if learning jsp.
0
 
fargoCommented:
I don't think i got your point. But still will try to explain..

In an html link and parameter that comes after "?" in a link is for parameters passed to the link.
ex: http://yoursite.com/page.cfm?email=youremail&moreparam=morevalue.
here email and moreparam are parameters OR variables (in your term) and youremail and morevalue is value associated with it. The first parameter is appended to the link with "?" and further with "&". Parameters needs to be encoded too.

>>how to say that this text "form.email" evaluates to "someone@adomain.com" and is not just text - it is a variable.
What do u mean?


0
 
TimYatesCommented:
either:

  ${form.email}

or

  <%= form.getEmail() %>

or

  <c:out value="${form.email}"/>

Depending on which version of JSP you are running, whether you have JSTL, and how the bean represented by "form" is set up...

Tim
0
 
dgrafxAuthor Commented:
Now we're getting somewhere
So I'd say "page.cfm?email=${form.email}" ?

the page name is loginsubmit.jspa - does that say anything?
if not, will one of the versions of "form.email" you posted work in all?

I don't know jsp but need to supply code for one of their (affiliate) pages.
Yes, I too wondered why they couldn't just do something simple for us.
0
 
TimYatesCommented:
I have no idea what a jspa file is... :-/

If it's just a standard JSP then it depends what "form.email" is...

is "form" a variable containing a bean?
0
 
dgrafxAuthor Commented:
?
Lets just say it's a standard jsp page.
form.email comes from a form submission on a previous page.
I don't know enough about beans to say if it contains a bean.

1) users enter email & password on a login page - then submit the form
2) I just need to grab the value of the form field named "email"

I believe it's just as simple as that, and if they are using "beans" to do other "stuff" - I should still be able to get "form.email" - is that correct?
0
 
TimYatesCommented:
ahhhhhhhhhhhh

I get it now!

    <%= request.getParameter( "email" ) %>

should do it :-)
0
 
dgrafxAuthor Commented:
so it's page.cfm?<%= request.getParameter( "email" ) %>

is that correct?
if not, will you write it out please.
0
 
TimYatesCommented:
or:

    ${param.email}

if it's a JSP 2.0 container :-)

Tim
0
 
TimYatesCommented:
>> is that correct?

That should do it...
0
 
dgrafxAuthor Commented:
https://ourdomain.com/qh/leadssignup.cfm?<%=request.getParameter("email")%>
or
https://ourdomain.com/qh/leadssignup.cfm?${param.email}

is this correct?
0
 
dgrafxAuthor Commented:
I meant to add will this send a url param named email to the cfm page?
0
 
TimYatesCommented:
Sorry:

      https://ourdomain.com/qh/leadssignup.cfm?email=<%= java.net.URLEncoder.encode( request.getParameter("email"), "UTF8" ) %>

Should do it...
0
 
dgrafxAuthor Commented:
OK - great
I told you guys this was really simple!
It was so simple I couldn't explain it!

Thanks a lot
0
 
TimYatesCommented:
:-)  Glad we got it sorted out in the end :-)

Good luck with it all!!

Tim
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 8
  • 7
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now