Joe Wolf

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

Recent posts by Joe Wolf

Hi all, I have multiple checkboxes with the same name but with different values in a JSP page that I want to initially display as checked. I can do this using a javascript function but I would like to be able to do this through Struts. Namely, I'd like the Struts Form Bean to contain something like this:
private String[] myCheckboxes = null;
public String[] getMyCheckboxes()
public void setMyCheckboxes(String[] myCheckboxes)
so that whenever a combination of checkboxes are checked, their values are added to the String array. And, by setting myCheckboxes before displaying the page, Struts will check the checkboxes for me. Does anyone know a way to set up struts-config.xml to do this, and if this is the best approach when dealing with Struts and multiple checkboxes?
22 years ago
Given a String, is there a way to make sure that it's a valid real number, containing only the digits 0 - 9 and has no more than one decimal point? Would attempting a cast and catching an exception work or is there a better way?
23 years ago
Actually, now even the <SERVLET> line at the beginning of the file is not even working.
23 years ago
I have "successfully" installed JSSI support of my web server. If the <SERVLET> is the very first tag of the file, the servlet will be called. However, if <SERVLET> is after <HTML> then I will get an error in the .jhtml file that says:
<!-- ERROR: ------------
java.lang.ClassNotFoundException: can't find servlet named "Hello"
at org.apache.servlet.ssi.ServletInfoRequest.runServlet(ServletTagHandler.java, Compiled Code)
at org.apache.servlet.ssi.ServletTagHandler.executeTag(ServletTagHandler.java, Compiled Code)
at org.apache.servlet.ssi.PageParser.interpretPage(PageParser.java, Compiled Code)
at org.apache.servlet.ssi.PageParser.process(PageParser.java, Compiled Code)
at org.apache.servlet.ssi.PageParserServlet.doGet(PageParserServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java, Compiled Code)
at org.apache.jserv.JServConnection.run(JServConnection.java, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
-->
The thing that bothers me, though, is that it worked before, and I'm not sure what I could have done to cause it to stop working. I didn't move any class files, I didn't change any configurations. The only thing I can think of is that I was doing a lot of servlet testing which, in turn, caused ERROR's and EMERGENCIES in mod_jserv.log. Does anyone have ideas on how I can get everything working properly?
23 years ago
I suppose it'd be difficult to give exact instructions. But given that JServ and MySQL are installed, you should now install a driver so servlets you can user JDBC for MySQL access.
http://www.mysql.com/downloads/api-jdbc.html
Then, depending on what kind of security you want on your databases, you have to create a MySQL user someuser@"%" who has with the appropriate privileges. Do something like
GRANT ALL PRIVILEGES ON my_jdbc_database.* TO someuser IDENTIFIED BY 'somepassword';
For tighter security, replace "ALL PRIVILEGES" with "SELECT" or "UPDATE". After creating the user reload MySQL with
# ./mysqladmin reload �p
Then you create a servlet in your repository that can read data from my_jdbc_database. You can find example code on the web for this with the mm driver documentation.
When I click on Post Topic at the JavaRanch, I can immediately type in the textbox "Your UserName". But on my page, you have to click on the textbox before you start typing in it. How do I rig it so the cursor is is a textbox when the page loads?
If you want to issue a CREATE, DROP or ALTER command in SQL, which function should you call on your Statement: executeQuery(), executeUpdate(), or execute()?
I'm very new to Java so I'm not sure what goes on with the programs I "copy" but now I am writing a servlet with a doPost() method that prints out HTML. In this HTML is a <form> with an action that calls the same servlet again.
Would this approach spawn multiple instances of my Servlet class? I'd rather have one instance of a class with content that gets modified based on user HTML input. What would be the best way to do that?
23 years ago
I found this Swing Demo applet at http://192.9.48.9/products/plugin/1.3/demos/jfc/SwingSet2/SwingSet2.html that shows the source code of the applet in the applet window. I can highlight it but I am unable to copy it with Ctrl-C or through any other means.
What are some ways to allow text in your swing applet to be copied with Ctrl-C and pasted somewhere else?
23 years ago
I finally did get JSSI to work. It's not that spectacular but it does allow me to totally separate the Java code from the HTML code...so all the HTML authors have to do is include the line <SERVLET CODE="Authorize"></SERVLET> at the beginning of the file to make sure its viewers have been authorized.
If I were to use JSP, would it allow me to do the same thing?
23 years ago
Does you data properly go into seperate columns? Mine won't.
23 years ago
I want to have HTML writers be able to insert a line at the beginning of their code that calls a servlet. I tried setting up JSSI-1.1.2 on my Apache 1.3.20 server but it didn't recognize <SERVLET> tags. I tried using SSI <!--#servlet code="yadayada" --> but Apache didn't recognize that command.
What should I do? Should I use JSP? Or, has anybody successfully installed JSSI? If so, how did you do it?
23 years ago
I'm not sure what your "corruption" of data means exactly but if you're like me, it means that the file isn't formatted correctly...instead of putting data in seperate columns, it would just stick everything in one column, delimiters and all.
I may be wrong, but I have a strong belief that it's not BufferReader's fault but it's Excel's fault for not properly interpreting the delimiters in the input file. Unfortuntely, I don't know how to fix this problem yet.
23 years ago
I mean, "4.76" and "4.7"
23 years ago
I just tried the servlets out on Netscape Communicator 4.67 and they worked. Perhaps this is just a Netscape 4.6 bug or something.
23 years ago