• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show Table from the database

 
Madtoni Delas llagas
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hei all,
can any1 help us how to display the table we were doin'.. here's the code... can any1 help us locate where's the error or is der some code we had not declare...

<-- Code of display.jsp -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<HTML>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>display.jsp</TITLE>
</HEAD>
<BODY>
<!--html:form action="/display" type="entry.actions.DisplayTech" name="techForm" scope="request"-->
<jsp:useBean id="techlist" class="java.util.ArrayList" scope="request"></jsp:useBean>

<TABLE border="1">
<TBODY>
<TR>
<!--TD>Entry ID</TD-->
<TD>From Point</TD>
<TD>To Point</TD>
<TD>North</TD>
<TD>South</TD>
<TD>Deg</TD>
<TD>Min</TD>
<TD>East</TD>
<TD>West</TD>
<TD>Distance1</TD>
<TD>Distance2</TD>
<TD>Bounded By</TD>
<TD>Of Plan</TD>
<TD>Action</TD>
</TR>
<logic:iterate id="techiterate" name="techlist">
<TR>
<!--TD><bean:write name="techiterate" property="entry_id"/></TD-->
<TD><bean:write name="techiterate" property="frm_point" /></TD>
<TD><bean:write name="techiterate" property="to_point" /></TD>
<TD><bean:write name="techiterate" property="north" /></TD>
<TD><bean:write name="techiterate" property="south" /></TD>
<TD><bean:write name="techiterate" property="deg" /></TD>
<TD><bean:write name="techiterate" property="min" /></TD>
<TD><bean:write name="techiterate" property="east" /></TD>
<TD><bean:write name="techiterate" property="west" /></TD>
<TD><bean:write name="techiterate" property="dis_one" /></TD>
<TD><bean:write name="techiterate" property="dis_two" /></TD>
<TD><bean:write name="techiterate" property="bound" /></TD>
<TD><bean:write name="techiterate" property="plan" /></TD>
<TD>EDIT<html:link paramId="entry_id" paramProperty="entry_id" paramName="tech" href="updateTech.jsp"></html:link>
</TD>
</TR>
</logic:iterate>

</TBODY>
</TABLE>
<!--/html:form-->
</BODY>
</HTML>


<-- Code of DisplayTech.java (ActionClass) -->
package entry.actions;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import entry.dao.DisplayTechDao;
import entry.forms.TechForm;
import entry.manager.TechManager;

/**
* @version 1.0
* @author
*/
public class DisplayTech extends Action {

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

ActionErrors errors = new ActionErrors();
ActionForward forward = new ActionForward(); // return value
TechForm techForm = (TechForm) form;
DisplayTechDao displayTechDao = new DisplayTechDao();

try {

TechManager techManager = new TechManager();
ArrayList techlist = techManager.DisplayTech();
request.setAttribute("techlist", techlist);


} catch (Exception e) {

// Report the error using the appropriate name and ID.
errors.add("name", new ActionError("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);
}
// Write logic determining how the user should be forwarded.
forward = mapping.findForward("display");

// Finish with
return (forward);

}
}

Currently, we were using java Struts.

[ ]
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this to the Struts forum where I think its a better fit -- so please post your replies there. Thanks!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic