wood burning stoves 2.0*
The moose likes Struts and the fly likes html:link forward problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link forward problem." Watch "html:link forward problem." New topic
Author

html:link forward problem.

Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 207
Hi,

Here is the scenario:

The JSP file is :
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>

<head>
<title>JSP Page</title>
</head>
<html:html>
<html:base/>
<body bgcolor="#FFFFFF">
<html:link forward="listUser">List User</html:link>
Comment out
</body>
</html:html>

the struts-config.xml file is :

?xml version="1.0" encoding="UTF-8"?>
<!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="createForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="name" type="java.lang.String" />
<form-property name="address" type="java.lang.String" />
</form-bean>
<form-bean name="indexForm" type="org.apache.struts.validator.DynaValidatorForm"/>
<form-bean name="listForm" type="org.Hibernate.struts.form.UserListForm"/>
</form-beans>

<global-forwards>
<forwardname="listUser" path="/list.do"/>
</global-forwards>

<action-mappings>
<action
path="/list"
type="org.Hibernate.struts.action.UserListAction"
name="listForm"
input="/jsp/index.jsp"
<forward name="refresh" path=""/>
</action>
</action-mappings>
</struts-config>


when I run it, I got the following error message:
exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:446)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:329)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:475)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:334)
org.apache.jsp.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:146)
org.apache.jsp.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:106)
org.apache.jsp.jsp.index_jsp._jspService(index_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Please help what the problem is.


Thank you very much
Benson
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm not sure why you're getting this error, but wouldn't it make more sense to code it like this?

<html:link action="/list">List User</html:link>


Merrill
Consultant, Sima Solutions
Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 207
Yea! You are right! This way works fine. However, forwrad attribute works either. As I did this and worked fine before. I don't know what the problem is.

If anyone knows, please help.


Thanks
Benson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:link forward problem.
 
Similar Threads
For Struts developers
Configuring First Struts Application
Error while farwarding link to next page.
Struts Error
MalformedURLException