Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html and bean tags not working in struts

 
Joy Mitra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jsp file

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<html:form action="CreateEmployee.do">
<!--<h1>Hello World</h1>
<input type ="submit" value = "Click"></input>
-->
<table>
<tr>
<td align="center" colspan="2">
<font size="4">Please Enter the Following Details</font>
</tr>
<tr>
<td align="right">
First Name
</td>
<td align="left">
<input type="text" name="firstName" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
Last Name
</td>
<td align="left">
<input type="text" name="lastName" size="30" maxlength="30"/>
</td>
</tr>

<tr>
<td align="right">
Age
</td>
<td align="left">
<input type="text" name="age" size="10" maxlength="10"/>
</td>
</tr>

<tr>
<td align="right">
<button type="submit" value="Submit" >Submit</button>
</td>
<td align="left">
<button type="reset" value="Reset" >Reset</button>
</td>
</tr>
</table>

</html:form>
</body>
</html>


web.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>StrutsDemo</display-name>
<!-- Standard Action Servlet Configuration (with debugging)
-->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>



</servlet>
<!-- Standard Action Servlet Mapping
-->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List
-->
<welcome-file-list>
<welcome-file>/JSP/index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors
-->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

</web-app>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic