In general, you use the <html:link> tag

http://jakarta.apache.org/struts/userGuide/struts-html.html#link


For the destination of the link, it takes one of four attributes: forward, action, href, or page.


The mechanism for specifying a single parameter for the link uses these attributes: paramId, paramName, paramProperty, paramScope

The value of paramId is the request parameter name. In your HTML sample, then, this would be "page", although in your ActionForm, this would probably be "pageName". (You probably want those to be consistent with each other.)

You can specify the value for the parameter with the appropriate combination of paramName, paramProperty, and paramScope, with semantics analogous to "name", "property", and "scope" in the various bean tags.

If you need to specify multiple parameters, this is done with a map whose keys are parameter names and whose values are the values to be put in the URL. See the docs for more details.


However, I'm guessing from your example link that you'd pass the same parameter in the link every time -- that is, you'd always want the text "Contact List" linked to the same URL. In this case, the better Struts "way to do it" would be to define different action mappings for each of the various parameters you would pass. This leaves you a lot of future flexibility about how the functionality is provided. If necessary, you could write a separate Struts Action class for each mapping, or you could use one action for several mappings and use an action mapping "parameter" to dispatch execution to a parameter-specific method inside the action.


Hope this helps.

Joe


At 14:23 +0100 9/9/03, Mehran Zonouzi wrote:
Hi,

I have the following link in my JSP page:

<td width="130"><a href="/servlets/blotter/Contact?page=viewcontactlist" target="rightframe" class="linkbold">Contact List</a></td>

I want to mimic the above using Struts JSP tags(I don't want to use a SUBMIT button). However, I want to call my ActionForm class instead of the servlet and I would like to set the value of the param 'page' to 'viewcontactlist' for my ActionForm class so that my Action class can use it.

Is it possible to do this?


Here is my ActionForm implementation:


import javax.servlet.http.HttpServletRequest;
import org.apache.strus.action.*;

public final class ContactForm extends ActionForm {

// page parameter from the CDS menu

      private String pageName =null;
      public String getPageName(){
            return (this.pageName);
      }

      public void setPageName(String pageName){
            this.pageName = pageName;
      }
}




--


This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "If nature worked that way, the universe would crash all the time." --Jaron Lanier


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to