• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts JSP/ActionForm error

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

I've recently started using Struts and JSP and I'm having a problem. In my JSP page I get the following error:

'Cannot compile against source model DetailForm issued from DetailForm.java'

I'm using Eclipse 3.0 and Lomboz for development. With Apache Struts 1.1.

DetailForm.java is an ActionForm class that represents a simple HTML/JSP form with employee details on it. This is included into the JSP page using the jsp:useBean tag.

I've got the gets and sets in DetailForm.java so I don't understand what is going wrong.

Any help would really be appreciated. Even if it's just a guess as to where this problem is originating from.
If you want me to post my code just let me know.

Thanks in advance
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Mohammed ,

Your question is not clear to me!!

In struts you call actionForm by there names by mapping them to their class in struts-config.xml.

how you are introducing it using jsp:useBean tag ?? this is not clear to me.

one more thing, there is different forum for struts
[ October 27, 2004: Message edited by: Shailesh Chandra ]
 
A Mohammed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for posting in the wrong forum. Maybe you could move the post? (please!)

Anyway, I am still struggling with this problem. Basically, I understand that the struts-config file defines the mappings, but I do not understand what the jsp:useBean tag does.

The problem is that I am modifying some existing code to fit a new application. The existing code was written a few months ago and worked on different versions of Lomboz and JBoss.

I've attached my code below, so could you please take a look and let me know what might be wrong with it.


 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Muhammad,

Actually, <jsp:usebean> tag is a jsp tag. it is not a struts tag. you should read out some tutorials or some books to know in detail, what is the function of this tag.

I understand that you need some help. but we can not figure out what is wrong there in your code, and what should we consider as wrong.

you need to specify the following,

- what are you expecting
- what are you getting
- if exception, then which exception
- if some other thing, then what

tip: you can download a nice book on servlet & jsp from theserverside.com

thanks,
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Mohammed

As adeel said <jsp:useBean is not struts tag....

you need to do something like this but read a struts book otherwise thing will not clear

in struts-config.xml there is a tag <form-beans> you define your formclass there as




Map your form to your action class in <action-mappings> tag. You must be doing same

and to use same in jsp you can do like





Hope This helps
[ October 27, 2004: Message edited by: Shailesh Chandra ]
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi A Mohammed,
May I know your struts-config.xml.
I think your action form class is not registered on struts-config.xml

Hope this helps..
thanks
daniel
 
A Mohammed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your help so far. You're all very quick off the mark!

Shailesh, so the method you described would allow me to use the <bean:write tag to write any attribute of an action form class that is registered in struts-config.xml.

Would I have to have a jsp:useBean tag or anything else before I use the bean:write tag. Also what is the format/parameters of the call to bean:write?

Daniel, I've attached my struts-config.xml below, but I'm sure I have registered my action form class.


 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Mohammed

to use <bean:write you will have register tld like this then you can use method told by me.

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

you struts-config.xml seems ok,I would like to reconfirm if you are getting error while invoking url /detail
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this thread to the Web Frameworks forum, since it is really about Struts.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic