1

I am new to struts so this could be a basic concept I am facing problem with.

I have a code which access the ID of util:copyTag inside scriptlet:

<%@ taglib uri="/WEB-INF/tlds/copytag.tld" prefix="util" %>
...
...
<util:copyTag id="tablebuffer" >
....
</util:copyTag>

<%
        Hashtable h=new Hashtable();
        String Key = "key1";
        h.put(Key,tablebuffer);
%>

When using this code in eclipse, line h.put(Key,tablebuffer); gives a red marker with popup text:

Multiple annotations found at this line:
    - tablebuffer cannot be resolved to a 
     variable
    - tablebuffer cannot be resolved to a 
     variable

Is it possible to use the ID as a variable, or is there some other way to do this. Actually I was given this code and told that code works fine. However when I configured the code in Eclipse I am facing the mentioned issue.

Kindly help me with this issue.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Rajeev Singh
  • 504
  • 2
  • 7
  • 21

1 Answers1

2

The only possible answer is:

  1. Never use Scriptlets anymore: they're a bad practice.
  2. Never use Struts1 anymore: it is EOL.

Apache Struts 1 End-Of-Life (EOL) Announcement

The Apache Struts Project Team would like to inform you that the Struts 1.x web framework has reached its end of life and is no longer officially supported.

[...]

We plan to start a new project based on Struts 1. Can we still do so?

Basically yes, but we would not recommend doing so. As long as no code line is written it is very easy to conceptually select an alternative web framework such as Struts 2.

Also, Struts 2 is easier and more powerful... really, if you are starting something new (and not maintaining a huge S1 project), switch to it, or to the alternatives (JSF 2, Spring MVC, and so on)

Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • Thanks for your response. I would have used struts2, however the project is developed using struts 1 and i need to modify one of its module. It would be a great help if you could suggest some solution to the mentioned problem in the given context. – Rajeev Singh Dec 23 '13 at 17:16
  • 1
    Ok, then you are forced to use Struts1, but not forced to use Scriptlets; **JSTL** is out there to help you, try it with a small refactor of the existing parts you are working with. I'm sorry, that error doesn't say nothing to me, but maybe it will go away, or it'll become more verbose, by simply using the aforementioned tag library instead of scriptlets. – Andrea Ligios Dec 23 '13 at 17:24