Author
struts 1.beginner, code not working
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
I am a beginner , just read a book of struts and tried my first app on it. can anyone tell what is the problem with my code . it gives an error at line 7 :
<html:form action="/starFinder" >
my index.jsp is :
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
am i using the wrong tag ?? or is it something else??
SCJP 6.0 (86%) SCWCD 5 (94%)
M Turner
Greenhorn
Joined: Dec 16, 2009
Posts: 25
Does your struts.xml have an action mapping for "/starFinder"? If not, your page will bomb.
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
my struts-config.xml is as follows : yes it has the mapping
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
Anyone please help me out? I am stuck at the first step ?
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
I have a little modification:
my index.jsp is:
my struts-config.jsp is :
now i m getting the following exception:
org.apache.jasper.JasperException: java.lang.NullPointerException : Module 'null' not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:97)
org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
am using struts 1.3 tomcat6.0.24
please help me out.i m stuck at my first trial app.
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted May 06, 2010 17:07:48
0
Are you accessing the JSP page directly?
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
I typed the following link :
http://localhost:9000/ch03app
and my index.jsp is in the ch03app directory.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted May 07, 2010 07:35:27
0
Pages with Struts tags shouldn't be accessed directly; the tags won't work. In general, there shouldn't be any JSP pages accessed directly in an MVC-based app.
saima kanwal
Ranch Hand
Joined: Oct 05, 2009
Posts: 148
can you please tell me how can i fix that? my index.jsp is :
web.xml is:
struts-config.xml is :
please tell me how can i prevent in index.jsp from accessing directly?
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted May 07, 2010 11:39:19
0
Don't type into the browser.
JSP pages should be under WEB-INF to disallow direct access. JSP pages with Struts 1 form tags must go through an action: configure an action for the input page somehow.
subject: struts 1.beginner, code not working