Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:link causing exception

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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.

Thanks
Devi
[ March 03, 2006: Message edited by: Sreedevi Vinod ]
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://struts.apache.org/struts-taglib/tagreference-struts-html.html#html:link:

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic