I have a class FindEditorData.java. I want to pass a vairable 'username' to this class for some processing. This class is invoked from a JSP this way:
and the value of the 'username' is obtained this way:
Due to my limited knowledge in Struts, I cannot figure out what to do. Let me explain the problem: 1. There is this method inside the FindEditorData.java:
Therefore, I do not make this class extends HttpServlet or extends Action. I cannot nest a method inside a doGet/doPost or the Action's excute(). 2. The action mapping in the struts-config.xml is declared this way:
I am stuck because I do not know how to pass 'username' to the FindEditorData.java. I cannot state:
because the FindEditorData is not a servlet and does not extend Action. The compiler will give me "cannot resolve symbol: request/session" I cannot pass a hidden variable from the JSP because I do not know how to retrieve the value of a hidden variable in a Java class. Need clever ideas. Please help. [ December 05, 2003: Message edited by: JiaPei Jen ] [ December 05, 2003: Message edited by: JiaPei Jen ]
I would have your page post to a standard Action servlet, then create an instance of your class from there. At that point, you have access to the request object (passed into the method via the Struts framework) and can pass the value to your class.
posted 16 years ago
There is a difficulty to make this class a regular servlet because there is this method inside the FindEditorData.java:
Therefore, I do not make this class extends HttpServlet or extends Action. I cannot nest a method inside a doGet/doPost or the Action's excute().
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop