This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Struts and the fly likes html:link causing exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link causing exception" Watch "html:link causing exception" New topic

html:link causing exception

Sreedevi Vinod
Ranch Hand

Joined: Jan 17, 2005
Posts: 117

I'm a beginner in Struts. My index.jsp is causing a NullPointerException when I use <html:link> to link to another jsp. This is the code I used.

If I replace the line containing html:link with
<a href="success.jsp" >Customer Form</a>
then it works fine. I tried removong the slash before success.jsp,
but still it is not working. Both the JSPs are in the same directory.
Please advise.

[ March 03, 2006: Message edited by: Sreedevi Vinod ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Often, if standard html works then there is no reason to use one of the Struts custom tags. One thing I would say is to look at the source html generated ("view source" in your browser) and see what URL it is generating. It is correct? You could also try href instead of page. From the docs at

href - Use the value of this attribute unchanged.
page - Use the value of this attribute as a module-relative URI, and generate a server-relative URI by including the context path and module prefix.

BTW...I am not sure how the html:base tag fits into this. It depends a little on how your application is deployed and your directory structure.

- Brent
It is sorta covered in the JavaRanch Style Guide.
subject: html:link causing exception
It's not a secret anymore!