0

Sorry i'm new to linkedhashmap, i have no idea how to apply for this. Appreciated for any help.

JSP file

<%
    LinkedHashMap htItem    = (LinkedHashMap) session.getAttribute("RiskItem");
    Vector Record           = new Vector();
           Record           = common.record(htItem); // i want to bring htrisk to record.java
%>

Record Java file

public Vector record(htItem) // how should i write in my parameter? 
{
    //data
}
jschew
  • 53
  • 1
  • 1
  • 9

2 Answers2

0

You need to provide a type to the argument (If I understand your question correctly)

public Vector record(LinkedHashMap htItem) // Type provided here 
{
    // code
}

Also, I don't get what the common variable does. I believe it's the instance of class Record. Please edit your question if so.

Sid
  • 4,893
  • 14
  • 55
  • 110
  • I did this, but get error message. "LinkedHashMap" cannot be resolved (or this is not valid type) for the argument htItem of the method record" – jschew Dec 18 '14 at 11:09
  • You might need to import it. e.g. `import java.util.LinkedHashMap` – Sid Dec 18 '14 at 11:10
  • common is a java file name. which i will called a method record. – jschew Dec 18 '14 at 11:10
  • Ok, sorry I am not able to understand what exactly you are looking for. Can you please elaborate? – Sid Dec 18 '14 at 11:13
  • same, have error message. "The import java.util.LinkedHashMap cannot be resolved". is it related to java compliance level ? – jschew Dec 18 '14 at 11:15
  • I don't think there is any compliance issue here. Where are you getting this error? In your JSP compilation or the `common` class? – Sid Dec 18 '14 at 11:16
0

I had a similar error. I wanted to pass a LinkedHashMap(String, LinkedHashMap) as a parameter. In the function, define the complete signature of your LinkedHashMap like:

public Vector record(LinkedHashMap<insert key, value> hitem)

It should work properly now. Also, don't forget to import LinkedList from java.util.