Hi all. Let me simplify the problem I'm thinking of and offer a small example. Say I have a struts action that happens when a user clicks a link on my site. The action fills a resultset and some other variables related to paging and such. These variables are stuck in the request and passed to the jsp page using struts. The jsp page then loops through the result set, prints the data, and then prints all the info for paging from the variables in the request. So, my question, is what if the user bypasses the links on the site and entered in the browser mysite.com/results.jsp - and the action didn't run so there are no variables in the request? If every variable isn't checked for null, then the page will error out. What is the correct way to program for this?
Really? Can you explain more about this, so i feel comfortable with making the change?
I'm using Websphere Studio developer for development, and I see that I have all my pages in a folder called pages which is under a folder called Webcontent. In the WEB-INF folder (which is under the webcontent folder also), there are 3 folders - classes, lib and src, and then there are some truts files and xml files.
Is this a Best Practice (putting the pages in the WEB-INF) folder? Or should I be doing something else in the code, and this is just a workaround.
Any JSP that should not be addressed via URL should be hidden under WEB-INF. These files are accesible via the forwarding mechanisms of any other resource. JSP files that need to be directly addressable via URL (I usually have few to none) should be outside of the WEB-INF folder.
Some of these html:links will go to the global forward and be jsp pages and some will be actions (.do).
As an example there is one link that is called Education. If I hold my mouse over it on the mainpage.jsp i can see that the link is .....jsp whereas the others are .....do
So, even though this is a link that was rendered from a global forward, when the user clicks on it it is still going directly to the jsp right? And that means that it wouldn't work if it was in the web-inf directory?
Thanks for helping me clear this up. I'm sure when someone else is searching for these answers next time, this thread will help them out.
That is correct. What your Struts tags look like is completely moot. All that matters is what HTML is sent to the browser. If the link ends up being a direct access to the JSP, that JSP cannot be hidden.