• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem in Creating Dynamic Link from Display Table

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I am trying to create dynamic link from display table data, but getting error. Below is my sample code.
****************Creating Link ******************************
<display:table name="employees" id="employee" pagesize="10" export="true" requestURI="index.do">
<display:column property="username" href="Edit.do" paramId="username" paramProperty="username"/>
</display:table>



*****************Calling screen ******************************

<html:form action="/EditEmployee"
name="EmployeeForm"
type="view.EmployeeForm"
scope = "request" >
<table width="500" border="0">
<tr>
<td> <bean:message key="app.username"/> :</td>
<td>
<bean:write name="EmployeeForm" property="username" />
</td>

<td><html:text property="username" /> </td>
</tr>
<tr>
<td>
<html:submit /><html:cancel /><html:reset />
</td>
</tr>
</table>
</html:form>

When ever I am clicking link, it is opening below url:

http://localhost/App1-ViewController-context-root/Edit.do?username=Kavaya

But giving error:

java.lang.NoSuchMethodError: void org.apache.struts.taglib.html.FormTag.setName(java.lang.String) at _editemployee._jspService(_editemployee.java:60) [/editemployee.jsp]
Can any one please help me in fixing this ussue , or suggest me some sample code to create dynamic link using display table.

Thanks a lot for your kind support.

Regards
..
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably in your bean you are missing the setter method setName
 
Bharti Ranjan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dey,

Thanks for your replly...

Buthave used getter and setter method, Below is the code for your reference

*************************************************************************
public void setUsername(String username)
{
this.username = username;
}

public String getUsername()
{

return username;
}

public void setPassword(String password)
{
this.password = password;

}

public String getPassword()
{

return password;
}

public void setName(String name)
{
this.name = name;

}

public String getName()
{

return name;
}

public void setPhone(String phone)
{
this.phone = phone;

}

public String getPhone()
{

return phone;
}

public void setEmail(String email)
{
this.email = email;

}

public String getEmail()
{

return email;
}

public void setDepid(String depid)
{
this.depid = depid;

}

public String getDepid()
{

return depid;
}

public void setRoleid(String roleid)
{
this.roleid = roleid;

}

public String getRoleid()
{

return roleid;
}

*****************************************************************

Alternatevely can you please help me in sending sample soure for creating dynamic link using display table.

Thanks a lot for your support.....
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Is it 'editemployee.jsp' file?, If no, then paste that. If yes, then we are missing some code here, because the error says "Can't find setter method for name property" and you didn't use 'name' property here. And please use Code Tags.
 
Bharti Ranjan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sagar, Thanks for your prompt responce

Providing the complete source which I am using here, Please help.....


Calling Link in Display Tab:
==================

<display:table name="employees" id="employee" pagesize="10" export="true" requestURI="index.do">
<display:column property="name" title="Name" headerClass="sortable" />
<display:column property="phone" title="Phone" headerClass="sortable" />
<display:column property="email" title="Email" headerClass="sortable" />
<display:column property="depid" title="DepID" headerClass="sortable" />
<display:column property="roleid" title="RoleID" headerClass="sortable" />
<display:column property="username" href="Edit.do" paramId="username" paramProperty="username"/>



It is calling below jsp EditEmployee.jsp
**********************************************************************************


<html:form action="/EditEmployee"
name="EmployeeForm"
type="view.EmployeeForm"
scope = "request" >
<table width="500" border="0">
<tr>

<td> <bean:message key="app.username"/> :</td>


<td>
<bean:write name="EmployeeForm" property="username" />
</td>

<td><html:text property="username" /> </td>
<td><bean:message key="app.password"/> :</td>
<td><html:text property="password" /></td>
</tr>
<tr>

<td><bean:message key="app.phone" />:</td>
<td><html:text property ="phone" />:</td>
</tr>
<tr>
<td><bean:message key="app.email" />:</td>
<td><html:text property="email" /></td>
<td><bean:message key="app.department" />:</td>
<td>

<html:select property="depid" size="1">
<html:option value="1">
<bean:message key="app.administration" />
</html:option>
<html:option value="2">
<bean:message key="app.network" />
</html:option>

<html:option value="3">
<bean:message key="app.engineering" />
</html:option>

</html:select>

</td>
</tr>

<tr>
<td> <bean:message key="app.role" />:</td>
<td>'
<html:select property="roleid" size="1">
<html:option value="1">
<bean:message key="app.manager" />
</html:option>
<html:option value="2">
<bean:message key="app.employee" />
</html:option>
</html:select>
</td>
<td colspan="2" align="center">
<html:submit /><html:cancel /><html:reset />
</td>
</table>
</html:form>
</body>
</html>

Using Below EmployeeForm.java
***********************************************************************


public class EmployeeForm extends ActionForm

{

protected String username;
protected String password;
protected String name;
protected String phone;
protected String email;
protected String depid;
protected String roleid;

public void setUsername(String username)
{
this.username = username;

}

public String getUsername()
{


return username;
}

public void setPassword(String password)
{
this.password = password;

}

public String getPassword()
{

return password;
}

public void setName(String name)
{
this.name = name;


}

public String getName()
{


return name;
}

public void setPhone(String phone)
{
this.phone = phone;

}

public String getPhone()
{

return phone;
}

public void setEmail(String email)
{
this.email = email;

}

public String getEmail()
{

return email;
}

public void setDepid(String depid)
{
this.depid = depid;

}

public String getDepid()
{

return depid;
}

public void setRoleid(String roleid)
{
this.roleid = roleid;

}

public String getRoleid()
{

return roleid;
}

}


Awaiting for your kind help ..........

Regards




 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your "html:form" tag is wrong.. Look at the correct attribute definition for html:form tag here.

Particularly, the error is in this line..



Also, you still forgot what I suggested in my previous post, Use Code Tags, It's very hard to read a code without Code Tags, and someone who wished to help you just move along to another thread.
 
Bharti Ranjan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sagar,

This issue resolved after correcting syntex, Thanks for your help.....

Can you please help me by providing sample code for passing multiple argument in Creating Dynamic Link from Display Table.

Thanks......
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bharti Ranjan wrote:Sagar,

Thanks for your help.....


My pleasure

Bharti Ranjan wrote:
Can you please help me by providing sample code for passing multiple argument in Creating Dynamic Link from Display Table.



Never used display tag, but can you elaborate what exactly you want to do ?
 
Bharti Ranjan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your revert....

I want to use Display Table for my report so I need not to worry about, page formatting,pagination and export.

Here I have created dynamic link and passed 1 argumant as below:

<display:column property="username" href="Edit.do" paramId="username" paramProperty="username"/>

It is working fine, I want how to pass multiple argumant while creating dynamic link in struts Display Table .

Regards....
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bharti Ranjan wrote:<display:column property="username" href="Edit.do" paramId="username" paramProperty="username"/>

It is working fine, I want how to pass multiple argumant while creating dynamic link in struts Display Table .


You mean you want to pass multiple parameters (not argument) to the link. I checked out display tag, there is no support to pass more than one parameter.. (As far as my short look is concerned)

Still, you can attach multiple parameter by explicitly appending it to link.. like



You can see How I modified the "href" attribute.. I'm not sure whether "bean" tag works by appending it to link, If not us EL ${userBean.id}..

Give it a try...

 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic