ListClient.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="DDDDDD">
<h1>
Struts logic:iterate tag</h1>
<html:form action="/searchClient">
<html:text name="ListClientForm" property="keyword" size="30" maxlength="30" />
<input type="submit" name="ClientSearch" value="ClientSearch">
</html:form>
<display:table id="listclient" name="sessionScope.ListClientForm.listclient" requestURI="/sortClient.do" pagesize="10" >
<display:column property="clientId" title="client Id" href="/getClient.do" sortable="true" />
<display:column property="clientName" title="client Name" sortable="true" />
<display:column property="clientAddress" title="client Address" sortable="true" />
<display:column property="clientSince" title="client Since" sortable="true" />
<display:column property="clientEmail" title="client Email" sortable="true" />
<display:column property="clientPhone" title="client Phone" sortable="true" />
</display:table>
</body>
</html>
-----
GetClient.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p> This is a get client.jsp </p>
</body>
</html>
---
GetClientAction.java:
package com.ford.crm_project.actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
/**
* @version 1.0
* @author
*/
public class GetClientAction extends Action
{
private final static
String SUCCESS = "success";
private final static String FAILURE = "failure";
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionMessages errors = new ActionMessages();
ActionForward forward = new ActionForward(); // return value
try {
// do something here
return mapping.findForward(SUCCESS);
} catch (Exception e) {
// Report the error using the appropriate name and ID.
errors.add("name", new ActionMessage("id"));
}
// If a message is required, save the specified key(s)
// into the request for use by the <struts:errors> tag.
if (!errors.isEmpty()) {
saveErrors(request, errors);
// Forward control to the appropriate 'failure' URI (change name as desired)
// forward = mapping.findForward("failure");
} else {
// Forward control to the appropriate 'success' URI (change name as desired)
// forward = mapping.findForward("success");
}
// Finish with
return (forward);
}
}
-----
struts_config.xml:
<action path="/getClient" type="com.ford.crm_project.actions.GetClientAction">
<forward name="success" path="/JSP/GetClient.jsp"/>
</action>
error while clicking the value of client id present in display table in listclient.jsp:
[11/05/11 20:20:43:586 IST] 00000021 TableProperti I org.displaytag.properties.TableProperties getLocaleResolverInstance No LocaleResolver configured.
Please let me know where the mistake is. I have included the itext jar file too.