• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

For Struts developers

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Struts and I am getting following exception when I try to run a very simple program.
Please help me to resolve this issue, It will be a great help.

Thanks


I am using Struts 1.1 and Tomcat 5.0.14.

-----------------index.jsp-------------------------
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<html:base/>
</head>
<body>
<html:link page="/CustomerDetails.jsp">Customer Form</html:link>
</body>
</html:html>

----------------------struts-config.xml------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="CustomerForm" type="mybank.app1.CustomerForm"/>
</form-beans>
<global-forwards>
<forward name="mainpage" path="index.jsp"/>
</global-forwards>
<action-mappings>
<action path="/submitCustomerForm" type="mybank.app1.CustomerAction" name="CustomerForm" scope="request" validate="true" input="CustomerDetails.jsp">
<forward name="success" path="Success.jsp"/>
<forward name="failure" path="Failure.jsp"/>
</action>
</action-mappings>
<controller processorClass="org.apache.struts.action.RequestProcessor"/>
<message-resources parameter="mybank.app1.App1Messages"/>
</struts-config>



-----------Exception-----------------------
java.lang.NullPointerException
org.apache.struts.util.RequestUtils.pageURL(RequestUtils.java:1596)
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:541)
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:495)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:353)
org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:138)
org.apache.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:100)
org.apache.jsp.index_jsp._jspService(index_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 
Nirodhaa Jaymenine
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please look into this and help me. It would be a great help.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the url you used to access the page? The error makes it seem like it can't figure out what the rest of the url should be for you link, and I assume that comes from the request.
 
Nirodhaa Jaymenine
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying. request url is

There is a <http:link> tag there

http://localhost:8080/App1/index.jsp
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Nirodhaa", please check your private messages for an important administrative message.
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I did a little digging, and I think your problem is that the html:link tag requires some parameters exist in the request object that are put there by your servlet. Since you accessed this jsp directly with out going through the servlet (I'm assuming that your servlet isn't set up to process .jsp request) the link tag crashes.

I think your options are to either create your link with out the html tag, or to set up a dummy action who's form and action class don't do anything and then forward to the jsp.
 
reply
    Bookmark Topic Watch Topic
  • New Topic