|
|
Re: included JSP shows error - can export to WAR [message #161741 is a reply to message #161697] |
Thu, 23 February 2006 15:14 |
Eclipse User |
|
|
|
Originally posted by: improbability.mindspring.com
Static includes are lexically inserted into the parent page at compile
time and the whole thing is compiled as one big page. As you've
discovered, the fragments themselves generally cannot be compiled
outside of that context. It's a bit like taking a random section of a
method and trying to run it through javac.
The solution is to give your imported fragments an extension, such as
..jspf, that prevents the environment from trying to compile them by
themselves. They will still be compiled, but only when specifically
imported, and any compile errors will appear next to the import line in
the parent page.
Philip Wilkinson wrote:
> Hi Im having problems exporting my dynamic web application to a war file.
>
> My dynamic web application is showing errors because I have several
> common jsp files that are included in the "main" jsp pages with <%@
> include file="header.jsp" %> etc. These "main" pages set up the beans
> and imports as normal, however I get an error against the included jsp
> file against references to the beans (or java objects in scriplets).
> Obviously WTP thinks its an error, but it wont be when deployed.
>
> BUT, I cant export to a WAR file because it says my Destination archive
> is invalid, which I assume is because of these errors.
>
> The obvious solution is to add <%@ page ... import="..." %> and
> <jsp:useBean .. /> at the start of the common include files. But I am
> reluctant to do this because
> a) Its a bodge to get round the wtp parser
> b) I'm unsure as to the effect of having multiple imports\useBeans in
> the final composite jsp page.
>
> Are my assumptions correct and is there anyway around this?
> Thanks in advance.
>
>
|
|
|
|
Re: included JSP shows errors - cant export to WAR [message #161857 is a reply to message #161839] |
Fri, 24 February 2006 02:21 |
Eclipse User |
|
|
|
Originally posted by: improbability.mindspring.com
Try adding "*.xjsp" to the file associations of JSP Fragment under
"General -> Content Types" in the preferences.
Philip Wilkinson wrote:
> Cheers. I changed my included jsp file extension to .xjsp and that
> worked - I can now export to a war.
>
> However its a minor point but I do miss my jsp editing and syntax
> colouring! I've tried associating the xml html and jsp editors with
> .xjsp and all I get is a plain text editor (even though the icon
> changes). (BTW I had to close the project and then re-open it to refresh
> the associations, F5 didnt work)
> Oh well I guess I'll get over it.
> Thanks again.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02507 seconds