×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Pass value on clicking link

Pass value on clicking link

Pass value on clicking link

(OP)
Hi!
I need to pass a value whenever a user clicks on a link.
I have an application which provides for permanent and trial users. I need to pass a value say type="trial" when the user clicks on link named trial and type="permanent", when clicked on permanent.
I am using the following format now and wish to add this facility
<html:link forward="trial" > Trial </html:link>

Also, once I do pass the value from here, how to receive it in the Form and Action classes?
Thanks in Advance,
Shanky

RE: Pass value on clicking link

well, if you wanted to use a button class, you could handle the operation of clicking a button in your action class and then execute to the correct code.

you could also use javascript onclick="function name" in your struts tag to call form posting in a function defined on the jsp. You can pass the value in the tag. (trial/perm)

Also,
for your form, you can use getter and setter methods.  You want to use the property parameter in your struts tags to connect to the methods.
Ex: <html:text name="blah" property = "userType"/>

in your form:

getUserType(){
return(usertype);
}

setUserType(){
this.usertype= usertype;
}

the property value actually calls the getter method.
notice the case difference or userType, its ok, struts will take care of it.


hope this helps, I am still kind of new to this!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close