Taking the portlets that were built originally to make SOAP Web Service calls and modifying them so that they would directly call the servlets that use the RESTful interface turned out not to be worth the effort. I decided to stick with just making the changes that would be needed to match the changes in the Web Services.
The first one that I started with was the geoid height calculator. It took awhile to figure out the new service calls and parameters and how to correctly set them up to get the results back from the server. The code completion feature of NetBeans was a big help with that.
Then I decided that I had not really designed the original portlet correctly in how it was interacting with the user to get the input data and display the output data. Plus I had not figured out in the first go-round how I should give the portlets a default input setting. I looked at more sample portlets, reread some of the documentation on the Portlet API and learned more about render parameters, RenderRequest, ActionRequest, ActionResponse, and how the portal, the portlet container, and the portlets all interact with each other and with the user.
I'm still not where I need to be. I can't decide the best approach for presenting the data input form to the user and then presenting the results from the Web Service call. Currently, I have not made use of the EDIT mode. I'm doing everything in the VIEW mode, checking in doView() to see if there's a calculated result to display. If not, the doView displays a JSP page that has the input form. If there are results to display, a different JSP page is displayed. On that page I have a "Back" link that takes the user back to the JSP page with the form after the results data has been viewed.
The problem I'm seeing is that when I'm in the same browser and I rerun the portlet after making some change to the code the view that comes up is the view that I had previously. I'm setting the ActionResponse render parameters in the processAction so they are available when the results are rendered. I would have expected that when the portal makes the first render request to the portlet that it would have no attribute data yet because the user has not yet entered anything in the form. But whatever information was in the render parameters from the previous use of the form, including the calculated result, is still available when doView() is first called. This causes the JSP page with the results from the last calculation to be displayed, instead of the JSP page with the form, as I would have expected. My thinking now is that instead of using two different pages in the VIEW mode to accomplish the gathering of data and displaying of results, what I may want to do is use the EDIT mode to display the page with the form and the VIEW mode to display the results and/or the blank starting page. But, again, I may run into the difficulty of not knowing the difference between the state of when there is data to display and when it's the starting state where the user has not yet submitted a request.
The Geoid Height Web Service offers two separate service queries. The one that the current portlet uses is the case where the user can input a single coordinate pair from which to calculate Geoid Height. I have the correct (I think) code inside the processAction method to handle the other case where the user can input a list of coordinate pairs and get the Geoid Height for each pair. But I couldn't decide the best way to display a second option in the form for that case. I decided to make these two cases into 2 separate portlets. As I begin to build the portlet for the case of multiple pairs I think I will use that one as the test case to see if it works better if I use the EDIT mode as the place to gather the user input.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment