Friday, May 22, 2015

Step 3: Creating a New Service and Webpage

This is the second third and final step out of three that you need to follow to complete this project. In this step, you will be creating your own services in Eclipse and customizing your webpage using Twitter Bootstrap. Follow the directions below:

1. Create your own Personality Insights service
  • Using the code from both the Demo Servlet and the Demo Wrapper, attempt to create a Personality Insights service that accepts text
  • If you get stuck, you can go back to the astopera Github page and look at the master branch of the cognitive showcase to see what I have done in my code
  • Tips: 
    • Use a protected void doGet
    • Import the packages from Demo Wrapper
    • Create a new personality insights object
    • Have it accept your username and password
    • Allow it for you to enter a statement
    • Have it determine the personality of the statement
    • Print the results onto the webpage
2. Create a webpage where you can enter the statement
  • Create a new file under web app (where index.jsp is) and give it a name ending with .jsp (i.e. pi.jsp) 
  • Go to http://crunchify.com/servlet-tutorial-getting-starting-with-jsp-servlet-example/ and scroll down to Step 2
  • Copy and paste the code in Step 2 into the .jsp you just created
  • See what is does by pushing it to your local servlet
  • Go back into the code and modify it so you can enter in a statement that will use personality insights to determine its personality
  • Go to the index.jsp and replace the name pidemo with the name of the .jsp file you just created
  • Again, you can check out the master cognitive showcase to see how I did it

3. Attempt to do this for Question and Answer
  • Tips
    • Use code from the PIServlet and QADemo (which can be found in the master branch of the cognitive showcase on Github) to create the servlet
    • Add the service to the index.jsp like how the personality insight service was added to it
4. Use Twitter Bootstrap to make website layout

5. You are now pretty much done! Tinker with the code until you get the services and the layout working the way you like and then push it to Bluemix like we do before. Congratulations on getting through all of this!


No comments:

Post a Comment