Andreas Bystrom

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

Recent posts by Andreas Bystrom

Hi all!

I have some trouble with checkboxes and struts, and haven't been able to find a similar question on the forum yet.

My problem is that I get this error when trying to use a checkbox:
javax.servlet.ServletException: No getter method for property theForm.dataObj.isEnabled of bean org.apache.struts.taglib.html.BEAN

My code in the jsp page looks like this:
<td><html:checkbox property="thForm.dataObj.isEnabled"/></td>

I have checked so that I have a getter method for this object, and html:text is working fine from the same object. The get method returns a boolean, is that incorrect? Is it possible to "link" a checkbox towards a value like this?

The get method:


If anyone has an example of how they use checkboxes it would be great!

Regards,
// Andreas
20 years ago
When I try to use RMI from a servlet I get this exception:
java.net.SocketException: Software caused connection abort: socket write error

I think that it can have somethign to do with policys. I have 2 jar files that my application uses that in turn uses two jar files that does stuff over RMI. These jar-files are located in {catalina.home}/common/lib/. This jar files also has a properties file that it uses. This file is located in myapp/WEB-INF/classes/file.conf

Do I need to set any policys for this application? I use tomcat 5.0.25 on an XP machine.

I use a network sniffer "ethereal" to look at what is really sent. What I can see is a exception that looks something like this:
"access denied to classloader ... java.security.AccessControlException ... access denied java.io.FilePermission /C:/java/jakarta-tomcat-5.0.25/webapps/myapp//WEB-INF/classes/- read". This exception is sent from the RMI server to the application computer.

Anyone have an ide of what I have missed?

// Andreas
20 years ago
Hi all!

I have a pice of java code that works fine when I'm just using it standalone. This application uses a RMI connection to another computer.

The problem comes when I add this code into a servlet and run it with tomcat (5.0.25). Now I get this exception when I try to send data to the remote computer.

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: access denied to class loader
Caused by: java.lang.ClassNotFoundException: access denied to class loader
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /C:/java/jaka
rta-tomcat-5.0.25/webapps/energis/WEB-INF/classes/- read)

Anyone have an idea of what I done wrong?

Regards,
// Andreas
20 years ago
Found out how to get it to work, just added the correct properties and everything went fine. It seems that the webserver needs some of them.
Thanks for all the help!
// Andreas
Looks like the solution is out there and should not be that hard to get. But when I'm trying out the suggestions given and reading about this, I this don't get this to work.
Heres a trace I got from my browser when I sent a POST (thisi swhat I want to with a small java program)
POST /mypages/servlet/AdminServlet?Service=TestService HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Referer: http://storstark.e-horizon.se/
Accept-Language: sv
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Host: storstark.e-horizon.se
Content-Length: 65
Connection: Keep-Alive
Cache-Control: no-cache
NAME=andreas&DATA=testing&Button.x=31&Button.y=6
The message is sent to ip computer.domain.se. Could someone show me how I should use URL and URLConnection to achive this? I guess some of the fields in the POST message are not important...
Regards,
Andreas
Hi!
I would like to build a program that will send HTML requests to a web server to trigger actions on there.
What I need is a simple program that can pretend to be a webpage sending data to test a servlet on the web server. I will for example need code to send a request to the webserver at 1.2.3.4 and simulate that I have set an INPUT html field to "Andreas".
Is the simplest way just to build the html as a string and then open a socket to the server and send it? Is there somewhere where I can find out how such strings should look like? Or should I use some existing java html extension? Note that I don't want a servlet application.
Thanks in advance,
Andreas
Thanks Ernest!
Didn't see your answer before my previous post. Your line solved my problem.
And yes, I live in beautiful Sweden
// Andreas
21 years ago
I have also tested to exchange the row
private static SimpleDateFormat hhmm_formatter = new SimpleDateFormat("HH:mm");
with this:
private static SimpleDateFormat hhmm_formatter = new SimpleDateFormat();
hhmm_formatter.applyPattern("HH:mm");
This is no difference.
Could it have something to do with that I'm in the +01 timezone (Sweden)? How can I avoid this localized time formatting?
// Andreas
21 years ago
Hi,
I want to get a string in the format of hhmm and uses SimpleDateFormatter for this purpose. My problem is that when the time is 1000 ms, it shows one hour ("01:00"). Have I missed something? The code that is below gives this result
>java TimeTest
01:00
01:00
01:59
02:00
what do I have to do to make it look like this instead:
00:00
00:00
00:59
01:00

Regards,
Andreas
21 years ago
I have no problem creating the clock that updates each second. I have a clock class that updates a Document, which is linked to both JTextFields. The problem with this is that I cant get a nice display off the JTextField in a JList. The list should look like this:
icon <tab> name <tab> clock
// Andreas
21 years ago
Hi!
My problem is that I have an GUI that has a list with enteties where each entety has a timer (in seconds) to it. A example of the JList would be this:
Andreas 00:34
Thomas 11:03
Bill 05:43
Each entity has its own clock and the update in bewteen doen't have to be syncronized.
Depending on what item in the list is selected, a second clock is shown in my GUI. This clock should be the same as the one in the JList.
My problem is that if I have a thread that sleeps for 1 sec, and then triggers an update on both the JList and the JtextField to repaint themselvs (whit the new time), they are not update exactly the same time. It is not nice when two clocks that are supposed to show the same time is updated with 0-0,5 seconds differance (sometime the difference is almost nothing and sometime it is up to 0,5 seconds).
How could I solve this? I have tried to use a Document for the clock that is the JTextField, my question is if there is some way to let the JList also be connected to a document in some way. As it is today, I have just overriden the in an extension to JLabel in an implementation of the I use to draw the string for the item (the name and the clock).
I would appreciate if someone can give me some help in this question or give me another apporach to solve this problem
Thanks in advance!
// Andreas
21 years ago
Hi all!
I have a scrollpane where the items shown is "tabbed" up from left to rigth in the pane. It is name (a tab) number (a tab) date ant that covers the entire scrollpane (this to make som space between the different colums).
Now when it is to many items in the list to show, a vertical scrollbar is added, I have set

My problem is that when the scrollbar is displayed, all my text dont fit in the scrollpane. What I need to do is to change the tabs when the scrollbar is added or removed. My question is if there are some event that will trigger when the scrollbar is added or deleted? If not, is there some other way to solve this?
Thanks in advance,
Andreas
21 years ago
I've found this example of how to make a JTextField rounded in the corners and now I wonder if someone could help me to add an border that is also rounded?
The code for the rounded textfield looks like this:

How is it possible to do a border on this JTextField that is rounded as well?
Thanks in advance!
// Andreas
21 years ago
I got it to work (I got the transparent image to show with transparent), I added this code:

My problem now is how I can place this picture wherever I want, without having to use a LayouitManager (unless there is a layout manager that enable you to do this)
Any ideas?
21 years ago
I do nothing special actually. Do you have an suggestion how to add the image image3.png in the code below?

When I try to add an image there, the transparent part of the imgae shows as grey.
Regards,
Andreas
21 years ago