Gezza Hall

Ranch Hand
+ Follow
since Jan 04, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gezza Hall

Hi all.

Can a standalone class access the session somehow? Basically, I want to call a utility class which isn't a servlet. I want this class to return the value of a session attribute.

The utility class is going to be called by Ajax via DWR, so I won't be able to pass in the session object as an argument. So the utility class will look something like this:



Can this be done, or are there any suggestions on an alternative? Ultimately I need my javascript to be able to access a session variable.

Many thanks.
15 years ago
Stevi, many thanks for your reply - and apologies to all if I was a little presumptuous in my earlier remark.

Like you, I would not normally want to use the form constructor, as I would need various session attributes to work with.

However, I'm not so sure what you mean by the default action - does struts just not simply call the execute method of the Action class? If it's possible to show any code snippets, or link to an example, the would be a great help.

Thanks.
15 years ago
I think the fact that no one has answered this simple question demonstrates why I will always choose SpringMVC in future!
15 years ago
By Backing form, I mean your form backing object. So for example the form which is displayed to the user will have a text input field 'surname', and the form object will have a String surname, with the usual get and set methods. In this case I would want to set the field before the form is displayed (maybe from a user object in the session).

Not sure the reset() method is what I'm looking for?
15 years ago
Hello.

Most frameworks offer some way of initializing your backing form object before the actual execute method is called. For example, you want some of your form fields to contain data before the form is presented to the user.

I've never known the best (simplest) way of doing this in struts. I did it once, but it was horribly complex code - there must be a standard way of doing this?

Any help appreciated!
15 years ago
Yeah I've done the experiments, and it's not a conflict with the other files.

Strangely, the rolling logs work on my local machine, which is not active at midnight - but they don't work on our tomcat machine which is permanently running.
I probably 'could' but want to keep it simple in this case.

Besides, I don't think that the existing log.properties file is the problem here - for some reason my logs simply aren't rolling!
Hi, I have a Logging utility class which wraps the log4j API and allows simple logging. It programmatically sets a DailyRollingFileAppender, and it's always worked without a hitch for me.

Now, I'm integrating into an existing tomcat webapp. Using my class, the log files are not rolling, but just continue to build up in the same file. I have noticed a properties file in the WEB-INF directory called log.properties, which contains the usual Log4j configuration. This file specifies a RollingFileAppender set to roll at 10Mb. Is there a chance that my class, when run under tomcat, is picking up this config file by default?

If so, can I stop it doing that?
If not, what else could be causing my log files not to roll?

Many thanks for any help!
Hello. I have a typical struts form, except that there are two buttons at the bottom - one goes back to the previous page, and the other goes to the next page. These buttons are images, and hence represented by ImageButtonBean objects.

I want to change the default behaviour of the form. If I hit 'Enter' while in one of the form text fields, the form acts as if the first button (back) was pressed - but I want to to think the second button (forward) was pressed.

Does anyone know a way I can achieve this, whether it be struts or html?

Thanks!
17 years ago
Well I managed it, you can do it without using the server.xml, if you implement this API - SecurityFilter - http://securityfilter.sourceforge.net/

Great stuff.
17 years ago
JSP
Sorry, but if you read my question you will see that I am trying to move away from configuring the server.xml file.

This is what I was already using, and all require modification of that file.
17 years ago
JSP
Hi all. I've built a JSP webapp which uses a authorization/authentification mechanism based on this idea here. Basically, a SecurityRealm is declared in the server.xml file.

It works great, but I need to adapt this so that I don't use the server.xml file, ie. all configuration is done using the web.xml. Can I achieve this, or would I have to completely redesign my whole app?

Thanks!
17 years ago
JSP
No, I'm not using javascript in that sense, goes against the whole purpose of using jsp and struts!

But in this instance, I do use some javascript. I use the...

<a href="javascript: history.go(-1)">Back</a>

...to get back to the original page.
18 years ago
JSP
Hi all,

I have a jsp/struts application. I want to ensure that after my form has been submitted (hence calling the struts form class which validates the form values) if the user clicks the back button, the form is displayed exactly as it was with all the values intact.

Note this is not a struts problem - the form fields are standard html notation, not struts. I simply want to ensure that the user can press 'back' without the page executing again - maybe some kind of caching thing?

Thanks!
18 years ago
JSP
Hello. I'm validating the output of my pages against the W3C validator at http://validator.w3.org.

It has brought to my attention that any struts input type tags, such as html:text, do not place a closing tag on the html:

<input type="text" name="emailAddress" value="...">

...which obviously fails the validation.

This must be a common problem - what is the workaround for this please?
18 years ago