Solved

Multiple params with html:link tag

Posted on 2006-10-22
4
194 Views
Last Modified: 2010-04-01
Hi,
In struts , how to pass a argument dynamically using the html:link and how to get that variable in the action class?

Regards
HK
0
Comment
Question by:harishkg
  • 2
  • 2
4 Comments
 

Author Comment

by:harishkg
ID: 17786774
<html:form action="/editClient">
<%
      ArrayList<Client> clientList = null;
      Object obj = request.getSession().getAttribute(LabelResources.CLIENTS.getMessage());
      if(obj instanceof ArrayList){
            clientList = (ArrayList<Client>)obj;
      }
      Iterator<Client> iter = clientList.iterator();
%>
                                                
<%
      long x;
      while(iter.hasNext()){
            Client client = iter.next();
            x=client.getId();
      %>
<TR>
<TD>
<!-- < html : option value="< % =client.getName()% > "> -->
<%=client.getName()%>
<!--  < / html : option> -->
</TD>
<TD>
<html:link action="/editClient?methodName=edit">edit</html:link>
</TD>

Like, how should I pass the clientID to the action in the above <html:link ??
0
 
LVL 4

Expert Comment

by:Tol_cv
ID: 17786811
in jsp:

<html:link action="/editClient?methodName=edit"  paramId="clientlId" paramName="client" paramProperty="id">

in your action:
<yourformbean>.getClientId();

 of course that means that your form has a property  clientId in it
0
 

Author Comment

by:harishkg
ID: 17786848
I used this
<html:link action="/editClient?methodName=edit"  paramId="clientId" paramName="client" paramProperty="id">edit</html:link>

org.apache.jasper.JasperException: Exception in JSP: /admin/icf/icf_list_client.jsp:50
this is the exception I got:

47:                                                       </TD>
48:                                                       <TD>
49:
50:                                                                    <html:link action="/editClient?methodName=edit"  paramId="clientId" paramName="client" paramProperty="id">edit</html:link>
51:                                                       </TD>
52:                                                 </TR>
53:                                           <%

root cause:
 javax.servlet.ServletException: Cannot find bean: "client" in any scope

0
 
LVL 4

Accepted Solution

by:
Tol_cv earned 50 total points
ID: 17788205
sorry i assumed you have a client bean in your jsp

<html:link page='"/editClient?methodName=edit&clientlId="+<%=client.getId()%>' />
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

A Short Story about the Best File Recovery Software – Acronis True Image 2017
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now