• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

html: link not working

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,

I am a beginner to struts .
In my Jsp page i am not getting the link when i use html:link.
I am not able to debug the problem.
Can anyone plz help me regarding this.


Below are the list of things i have done.

main page-->Index.jsp

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<html:link page="/pages/TestAction">Test the Action</html:link>

in struts-config.xml I have included under action-mapping tab.
<action
path="/TestAction"
type="zt.struts.TestAction">
<forward name="testAction" path="/pages/TestAction.jsp"/>
</action>
I have placed the jsp page in pages folder.

The TestAction.java file looks like this.

package zt.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class TestAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
return mapping.findForward("testAction");
}
}

i have placed the TestAction.class file inside classes floder in the package zt.struts.


The error I got is :

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
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
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:428)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:311)
org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectTag.java:294)
org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:268)
org.apache.jsp.index_jsp._jspx_meth_logic_redirect_0(org.apache.jsp.index_jsp:88)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:60)
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:322)
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)


Plz help me in finding the problem and correcting it.



Thankz,
Charan.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 - You need a declaration for the html taglib, like the one you have for the logic taglib.

2 - Be sure to read the docs for the taglibs. This one is for <html:link>. You probably want to code your link like this: <html:link action="/TestAction" ...>
 
You had your fun. Now it's time to go to jail. Thanks for your help tiny ad.
ScroogeXHTML 9.4 - fast RTF to HTML and XHTML conversion
https://coderanch.com/t/749563/ScroogeXHTML-fast-RTF-HTML-XHTML
reply
    Bookmark Topic Watch Topic
  • New Topic