This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

<html:link> with Struts

Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally developed in JSP, my MVC application is running well, and among others all the hyperlink calls.
Basically, I have a <frameset> used as base page and which contains at the left side (LowLeftWin) a menu whose items are all hyperlinks calling pages that have to be displayed in the right window (LowRightWin).

When I transform my JSP pages in Struts (to learn Struts), a problem appears : At the start of the website loading, I don't get the menu (left window) anymore, while I obtain well the first page (right window)

Note 1: The base page is the only one not containing Struts elements, only JSP elements (and located under 'Web Pages'). The calls to the menu (MC_LowLeft_1.jsp) and to the first page to display (MC_LowRight_01.jsp) are direct calls to JSP files.
All the other pages are (to be) converted with Struts elements and have subsequently the

directive at the top of the file. Also, they all reside in a subdirectory : 'Views'.

If the 'MC_LowLeft_1.jsp' page does not contain a <html:link ... element, but

, the problem does not appear and all the hyperlinks of the menu are operating well.

As soon as I substitute the html code at one place by the equivalent Struts element

, the problem appears.

... Exception in JSP: /Views/MC_LowLeft_1.jsp:19
19: <li><html:link page="/" >
cause mère : java.lang.NullPointerException

We know that the '<html:link>' element generates a link pointing to '/C/page', where ...
- 'C' is the application context : Here 'Vehic'
- 'page' is a URL, as written in the 'page' attribute of the '<html:link>' element.

From the code of the 'Views/MC_LowLeft_1.jsp' page, Struts generates in fact :

, making this way a call to 'struts-config.xml' which contains the 'action' element calling on its turn 'MC_LowRight_02.jsp'.

Here is my question of this session :
How to code correctly the URL of the page to call in

so that there is no exception mention anymore, that the menu '/Views/MC_LowLeft_1.jsp' appears and that I can operate any hyperlink of the menu (to call 'MC_LowRight_02.jsp', for instance) ?

Note 3:
- The 'web.xml', 'struts-config.xml' and 'struts-html.tld' files are well located in the directory 'Web Pages/WEB-INF'.
- The 'web.xml' file does contain the necessary <servlet> and <servlet-mapping> to use the action 'ActionServlet'.
- The 'struts-config.xml' file contains

n for the cases where a <form> or a URL from another page must be able to call this '/Views/MC_LowRight_02.jsp' page.

My development environment :

- IDE NetBeans 6.1
- Serveur Tomcat 5.0
- JSTL 1.1
- Java JDK 1.6.0_07

Is there a brave and illuminated soul who ... ? Thanks in advance.
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using the "action" attribute, <html:link action="MC_LowRight_02"/>?
Charles Van Damme
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use "action" instead of "page" in the <html:link tag, my menu of hyperlings appears as it ought in my left frame.

and each hyperlink calls the right JSP page in the right frame.
But why, in the tutorial (August 2004), can I see only 'page' ?
When I place the cursor just at the back of <html:link , a list of information and attributes pops up. Both 'page' and 'action' are in it. How could I know ?

Hum !
In a further page, similar problem, but regarding the 'html:form' tag :

Attribute name invalid for tag form, according to TLD

In the popup list, no mention of the attributes 'name' nor 'type'.
Do I have a problem of version of Struts and TLD ?

Once again, many thanks.
David Newton
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "name" attribute was deprecated back in Struts 1.1 (see the Struts 1.1 form tag documentation), and removed in Struts 1.2.
    Bookmark Topic Watch Topic
  • New Topic