2

I have build a Stuts2 multimodule app using Appfuse archetype from Eclipse Juno.

It works fine when ran through MVN Jetty:run.

But When I try to validate the project in Eclipse , it is giving me so many errors I am going to copy the errors here can someone please help me resolve them?

Getting Error :

Syntax error on token ""><s:param><s:text name="", ; expected    in  src/main/webapp/scripts/login.js

Syntax error on token "<", invalid MultiplicativeExpression  line 34  in src/main/webapp/scripts/login.js

Can someone please help with these errors?

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
Mohamed
  • 35
  • 6
  • I'm not sure I understand why there are S2 tags in a JS file in the first place; that seems like (a) a complete mixing of concerns, and (b) broken unless you're processing all your JS files as JSP files. – Dave Newton Sep 04 '14 at 12:21
  • @Dave , thanks for you reply , since the project is auto generated by appFuse framework , I am trying to understand the fact , struts tags are injected into js files ! – Mohamed Sep 04 '14 at 13:44
  • What are the files, can you post them? – Roman C Sep 04 '14 at 13:56
  • sine I a new member , I haven't the right to join files , these are links for the two files : login.js https://code.google.com/p/appfuse-demos/source/browse/trunk/tutorial-struts2/src/main/webapp/scripts/login.js and login.jsp https://code.google.com/p/appfuse-demos/source/browse/trunk/tutorial-struts2/src/main/webapp/login.jsp – Mohamed Sep 04 '14 at 14:06

1 Answers1

0

It's ok, because it's not a javascript code it has <script type="text/javascript"> tag where the code is. The file is a JSP file. JSP files usually have extension .jsp but there's no restriction to use extension for file name. JSP files or fragments being included to the main JSP file doesn't need to be validated, but if you want the tags to be recognized by IDE you should use JSP taglib directive at the top of the file

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

and may be others. It doesn't change the application itself but allows you to validate fragments like a normal JSP.

Roman C
  • 49,761
  • 33
  • 66
  • 176