Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i want to use jsp or html file to display content

 
Rajat kachhwaha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i dont know how to present this thing but, i am working on a project in which i have to populate the jsp or html file using the data i processed through java code, i know i can use servlets.
Please give an example of using and loading a html or jsp file when the server runs.
i want to put all my data in a html file and then use angularjs to organise it, i know all that things but only facing a small problem of displaying the jsp or html file when the server starts.
 
Stephan van Hulst
Bartender
Posts: 6337
79
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you process the request in your Servlet, you should add the processed data to the attributes of the request, and then forward the request to the JSP page. All the JSP has to do then is display the processed data.
 
Rajat kachhwaha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is exactly what i am looking for, but can you please elaborate as i am facing problem in doing this and it will be great if you can give me explanatory code snnipet for the same, i also want server should load my jsp file as soon as it gets started.
 
Dave Tolls
Ranch Hand
Posts: 1908
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "server should load my jsp file as soon as it gets started" mean?
What is it you are expecting to see?

The JSP is meaningless without a request to access it.
 
Rajat kachhwaha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:What does "server should load my jsp file as soon as it gets started" mean?
What is it you are expecting to see?

The JSP is meaningless without a request to access it.


What to do so that when server starts my index.html or index.jsp file should open in the browser, i dont want to put html code in my class as i want to use angularjs with the data recieved from java code and populate it to index.jsp or index.html
 
Dave Tolls
Ranch Hand
Posts: 1908
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then your browser needs to access the server using the relevant URL.

The browser has no idea whether the server has started or not.
 
Rajat kachhwaha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Then your browser needs to access the server using the relevant URL.

The browser has no idea whether the server has started or not.


okay got it!, and how about using web.xml for the same, can you please explain me the usage of <jsp-file> tag under <servlet> tag.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit confused as to how you plan to use JSP and AngularJS together -- they are not particularly compatible technologies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic