Struts2 Action: Reload the same page with another parameter

A client of mine asked for a way to search employees, not just filter them using the first letter of the family name.
I just provided a textfield and a link changing according to the textfield content: 

<script type=”text/javascript”>
function searchEmployee()
        = “<s:url value=”/Employees” />” + “?filter=”
        + encodeURIComponent(document.getElementById(‘firstName’).value);

<input type=”text” id=”firstName” value=”” onblur=”searchEmployee();” />
<a id=”filter” href=”<s:url action=”Employees” />” title=”Search by family name”>
    Enter the first letters of the employee family name


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: