hi,
the index.jsp you post in here, does not have a link to
search.jsp just 2 lines of text.
So i cant reproduce the error you described.
For example this index.jsp presents a link to search.jsp and it works:
(of course html:link will work too)
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<html>
<head>
<title>ABC, inc. Human Resource Portal</title>
</head>
<body>
ABC, Inc. Human Resources Portal</br>
<hr width="100%" noshade="true">
• Add an Employee<br>
<a href="search.jsp"> Search for Employees</a> <br>
</body>
</html>
But it seems your struts-config is not well configured
use <action-mappings../> instead of <action-mapping../>
suigion wrote:
Hi,
I have issue in building simple Struts. application. I encounter error when
I want to click the button that link to serach.jsp page from index.jsp.
I am using Struts 1.3.10, Apache Tomcat 5.5.17.
I am stack due to this error. thanks guys.. :)
below are the details:
Error message:
================
org.apache.jasper.JasperException: Exception in JSP: /search.jsp:16
13:
14: <html:errors/>
15:
16: <html:form action="/search">
17:
18: <table>
19: <tr>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException: Module 'null' not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
org.apache.jsp.search_jsp._jspx_meth_html_form_0(search_jsp.java:258)
org.apache.jsp.search_jsp._jspService(search_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
struts-config.xml
==================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="searchForm" type="com.anderson.minihr.SearchForm"/>
</form-beans>
<global-forwards>
<forward name="search" path="/search.jsp">
</global-forwards>
<action-mapping>
<action path="/search" type="com.anderson.minihr.SearchAction"
name="searchForm" scope="request" validate="true"></action>
</action-mapping>
<message-resources parameter="com.anderson.minihr.MessageResources"/>
</struts-config>
web.xml
==========================================================
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/dtds/web-app_2_3.dtd">
<web-app>
<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>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
index.jsp
====================================================
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<html>
<head>
<title>ABC, inc. Human Resource Portal</title>
</head>
<body>
ABC, Inc. Human Resources Portal</br>
<hr width="100%" noshade="true">
• Add an Employee<br>
• /MiniHR/search.jsp Search for Employees <br>
</body>
</html>
search.jsp
=======================================================
<%@ taglib uri = "http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri = "http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri = "http://struts.apache.org/tags-logic" prefix="logic" %>
<html>
<head>
<title> ABC, Inc. Human Resources - Employee Search</title>
</head>
<body>
ABC, Inc. Human Resources Portal - Employee Search<br>
<hr width="100%" noshade="true">
<html:errors/>
<html:form action="/search">
<table>
<tr>
<td align="right"><bean:message key="label.search.name"/>:</td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td></td>
<td>-- or --</td>
</tr>
<tr>
<td align="right"><bean:message key="label.search.ssNum"/>:</td>
<td><html:text property="ssNum"/> (xxx-xx-xxxx)</td>
</tr>
<tr>
<td></td>
<td><hmtl:submit/></td>
</tr>
</table>
</html:form>
<logic:present name="searchForm" property="results">
<hr width="100%" size="1" noshade="true">
<bean:size id = "size" name = "searchForm" property="results"/>
<logic:equal name = "size" value = "0">
<center><cTypeface:Bold>No Employees Found</center>
</logic:equal>
<logic:greaterThan name="size" value="0">
<table border="1">
<tr>
<th>Name</th>
<th>Social Security Number</th>
</tr>
<logic:iterate id = "results" name = "searchForm" property="results">
<tr>
<td><bean:write name = "results" property="name"/></td>
<td><bean:write name = "results" property="ssNum"/></td>
</tr>
</logic:iterate>
</table>
</logic:greaterThan>
</logic:present>
</body>
</html>
build.xml
==========================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<project name="MyTask" basedir="." default="compile">
<property name="src.dir"
location="WEB-INF/src/com/anderson/minihr"/>
<property name="classes.dir" location="WEB-INF/classes"/>
<property name="struts.lib.dir" location="c:/Program
Files/struts-1.3.10/lib"/>
<property name="tomcat.lib.dir" location="c:/Program Files/Apache
Software Foundation/Tomcat 5.5/common/lib"/>
<property name="junit.out.dir.xml" value="${report.dir}/junit/xml"/>
<target name="compile" description="Compiles the Task">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on">
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="${tomcat.lib.dir}/servlet-api.jar"/>
<fileset dir="${struts.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org