• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pass the content of a request to a java file from a servlet

 
Isaac Ferguson
Ranch Hand
Posts: 1028
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am sending data from a index.jsp to a Servlet, then I get it in the Servlet and then I want to retrieve it form another java file. When I redirect it to anothe jsp it works well.



when I type:



obviously the java file doesnt recognize the request. Is there some way to set a value in a servlet and retrieve it for get it later in another java file?

Regards, Isaac
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "another java file" I assume you mean another class?

If the class instance is part of the controller and has access to a request or the session, it would simply retrieve it from the session. After all, why did you put it in the session if that's not where you planned to get it from?

If the instance does not have access to the session, then the data should be passed as a parameter just like any other data.
 
Isaac Ferguson
Ranch Hand
Posts: 1028
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get the object "file" from the .jsp after select it from my locale and it should be upload to the server where the Servlet is located.



What should I put in "value" at teh moment when debugging the result is NULL

From the Servlet I m trying to get the whole object I know that this way is wrong



Any idea, please?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File uploading is not a simple task. Please see the ServletsFaq for an entry on file uploading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic