John Melton

Ranch Hand
+ Follow
since Aug 17, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John Melton

DBUnit is a project that is built on top of JUnit with specifically this purpose in mind. Also, there are some integration test classes in Spring that may also help you do what you're looking for. Check out the testing section of the Spring guide (if you're project uses the Spring framework of course).
15 years ago
Siteminder is a security product that uses LDAP as it's database of user information. It provides services, however, just like a normal application or service would. LDAP is just a database that holds user information and is accessed in a standard way.
15 years ago
What you're seeing is that your confidential guarantee is doing it's job. It's redirecting on login, but there's no "not confidential" guarantee. So, the servlet container understands from your web.xml that it must redirect to https when login.html is accessed, but there's nothing to tell it to go back. However, if your login.html form goes to say ... /LoginServlet, you could redirect from there to http:// ... landingpage.jsp or something like that, and that should do the trick. In other words you have to tell it to go back to http once, but after that, everything will be relative.
15 years ago
This is basically a question of optimization. The cardinal rule of optimization is measure first, then fix. You'll want to do what's already been suggested and log the time between each database call, as well as at the very beginning of the page and end. This way you can determine which calls seem to take the longest. I would run it repeatedly to get a good idea. Then, you'll need to start fixing each of the queries. This could involve adding indexes to the database (if you have that much control) which would fall under schema design. It could also be just straight query optimization. Those are issues however, that can be resolved. As was also mentioned earlier, you could go the route of stored procedures, which sometimes give a decent performance boost, but my guess is you're either missing indexes, have a TON of data, or have slow queries. Those are the places I'd look to start.
15 years ago
JSP
1. The standard is probably verisign if it's a real site. You can do what is called a self-signed cert if it's for development.

2. You should already have them. Here's some docs based on your version numbers

http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html
http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html

3. This should work fine. You just need to point to the correct url within your application, whether http or https. One point to note is that that apache must be configured for http and https and have those listeners both enabled. The doc above should help with that. You'll likely use the apache-tomcat connector, so tomcat probably will be listening on some non-standard port for communication with apache. You should disable it's other listeners if you don't want people to go directly to tomcat. Finally, just one last point that I don't have time to elaborate on here, but there are several types of attacks (like session hijacking) that are possible when both http and https are used. In my opinion, once a user is logged in, it should all be ssl. It's not that much of a performance impact, unless you're doing HUGE amounts of requests, and if that's true, you probably have enough hardware to handle it.

Hope this helps.
--jtm
15 years ago
It's looking for the commons-logging.jar file. If you copy that jar file into one of the directories in your classpath, or add the directory it's in to your classpath, it should be fine.

Hope this helps.
17 years ago
Dom is right, You can use the saveToken(), isTokenValid(), and resetToken() methods to use and validate tokens in your application. Check this site for a quick example - http://www.learntechnology.net/content/struts/struts_token.jsp

Hope this helps.
17 years ago
A very similar solution I have used in the past is to store this information in the database. This allows for tracking of user sessions over a period of time. However, it is an extra DB call. It seems to work fairly well though. The point that Vidya makes is also true. You would have to write a session timeout listener to remove the user from either the hash map or the database in order to make sure they could login again. The timeout listener would be called whenever the session times out (configured in web.xml)
Hope this helps.
17 years ago
Generally, if possible you should declare variable in the smallest possible scope you can. However, if it means you're creating objects in a loop as your example shows, that is very bad for performance if you don't have to do it. If you do have to, then it's fine. In your specific example below, I would choose your second option for the performances sake. However, you have to evaluate on a case-to-case basis.
Hope this helps
17 years ago
Pramod,
This should come from looking at your web.xml file, specifically the servlet mapping section. In this case your web.xml probably has a section that looks like the below. You could easily change the servlet named action to something of your own choosing and you could then get the requests. You're using struts though in this case, and struts RequestProcessor is taking care of the requests and routing them to the appropriate Action classes based on your configuration in the struts-config.xml

17 years ago
First of all a method call would look like ....doPost(request,response) -- without the types HttpServletRequest and HttpServletResponse, but actually with a servlet, doPost gets called (or doGet) just by making a request to the servlet - the servlet container takes care of that.
17 years ago
Do you mean how do you go to a servlet when you click on the link? If so, you configure a path when you setup a servlet in the web.xml. In the jsp, your link is to that url - the servlet container then takes it from there.

For example, you could have this in your web.xml



and this in your jsp

17 years ago
My assumption would be you'd probably want to go with an actual servlet, but I'm sure you could figure out a way to do it in an action. If you go with the servlet, yes, you'd then have to configure it in the web.xml. A google search can get you the code for that - search on something like "configure a servlet in web.xml java". I've only ever used raw servlets w/ PDFs - never tried it w/ struts. Maybe someone else could offer help if you want to go that route.
Hope this helps.
17 years ago
You'll need your code to look like this then



where myFormBean is the name of your struts form bean. Also notice the attribute collection instead of name. Give that a try
17 years ago
It amounts to this


I think if you want it to come up in the browser you use



Here are a couple URL's that may be helpful

http://www.javaworld.com/javaworld/javatips/jw-javatip94.html

http://www.onjava.com/pub/a/onjava/2003/06/18/dynamic_files.html

Finally, I've found the IText library to be very helpful for working with and generating PDFs from Java
http://www.lowagie.com/iText/

Hope this helps.
[ October 31, 2007: Message edited by: John Melton ]
17 years ago