Alia Huss

Ranch Hand
+ Follow
since Feb 13, 2009
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 Alia Huss

It should. If I put the whole <s:url> in the href of the <a> tag, it sends me to the correct page with the correct values preset.
15 years ago
It was a typo afterall, I had set the getter as private, not public.
15 years ago
Alright, I concede, that was a poor example.

If I instead have a table, with columns:


Each column has it's own date and in each column there might be a reservation, which has it's own id.
I want the link to open a popup, while the parent window stays as it was before the link was clicked.
And I want the fields of the popup to be populated with the values sent along with the URL.

Better?
Thanks
Alia
15 years ago
Hello!

When clicking a link for updating user information one of 6 fields doesn't get populated.

Here's the jsp code:
UpdateUser.jsp

The <s:textfield> that doesn't get populated is "phone"

In my action class I have the following code:


When the action's execute is called the value of phone is set with a value Ex. 0708090909

Any idea why this particular field isn't getting populated?
I can't see any typo's and by debugging I have established that the value of phone (in the action class) is set to something (not null and not an empty String)

Thanks
Alia
15 years ago
Hello!

My current issue:
I have a link:


When the link is clicked it calls the function called UpdateUser().


All that is working fine, but I want to send along the id of the user who is logged in:



In the action class the the execute method calls the method getPersonById() (located in PersonService.java) and then sets the values of the forms attributes with the values from the Person object.
It works perfectly well when the link doesn't open a popup and looks like this:

I understand that the problem with the codesnippet that opens a popup is that there aren't any parameters being sent along.

Thus I've tried the following but now no popup is opened:
xxx.jsp

The above code has also been tried with '' instead of "".
When I surround the <s:url> tags with ' ' I get a popup, but there are no values in it. (The execute method isn't even called)
And changing the function to:


Any ideas?
Thanks
Alia
15 years ago
Thank you so much!
It's working exactly the way I had imagined it.

Regards
Alia
15 years ago
Thank you David.
I'll go ahead an write an interceptor.
And I'll go ahead and ask a question about the interceptor just to make sure that I've got it right.
It's the interceptors work to redirect the user to the login page if he/she isn't logged in, right?


Thanks
15 years ago
Ah, thank you, I didn't know that.
I've now changed my filter and updated the previously posted code.
15 years ago
Hello!

This is what I'm trying to achieve:

When I try to access a page in my webapp I want to be redirected to the login page if I'm not already logged in.

I understand that using sessions you can see if someone is logged in or not?
How is this done?
I've looked at the example at :http://struts.apache.org/2.x/docs/simplelogin-with-session.html
But I have some questions about what happens in the example:

1. The execute method in their LoginAction class:

This code snipped adds two new things to the current session, right?
Would the map contain the String and the Date that I added previously if I do "session = ActionContext.getContext().getSession()" directly after?
Could the key "context" be changed to "userBean" and the Date object be changed to a Bean?

2. The loginChecker.jsp:

Obviously the webworks tags could be changed to struts tags (<s:if test=""> etc).
But what does "login" in the code "#session.login" refer to? Obviously it's the name of something stored in the session, but they don't put anything into the session that is called "login" as far as I can see. Could it refer to the action? Since there is an action configured in the xwork.xml that is called "login".


3. Is it wise to put a code snippet, like the one below, in every action which renders a page I only want logged in users to access?

Then sending anyone with an ERROR result to the login page, and letting anyone with a SUCCESS result continue to the page.
Or is there a better way?

Thanks in advance,
Alia
15 years ago
It was a while ago, but here's a copy of my web.xml


Only works with struts2-core-2.1.3.jar or newer (I use Struts2-core-2.1.6.jar)

I hope it helps.
Alia
15 years ago
Hello.

So, I have a jsp with an iterator. The iterator iterates through a List of ReservationBeans.
Each bean contains a couple of values, the date of the reservation is one of them.

My problem:

The list contains several ReservationBeans, some of the beans have the same date value.
Ex. There are two ReservationsBeans where the value of date is "2009-03-03".

If the iterator has already iterated a ReservationBean with the same date as the current ReservationBean I want it to ignore further instructions. This would be done with an <s:if> tag.

Ex.


So my question is, is there a way of collecting the date value of the previous ReservationBean from the value stack?
Or do you have any other clever ideas on how this could be achieved?

Thanks,
Alia
15 years ago
Wow thanks! That was helpful indeed!
Though "request.setAttribute("MY_LIST", list);" gets a compilation error,
Should I change my execute method so it takes a HttpServletRequest etc?

Ex.

Thanks
Alia

15 years ago
*coughs* It works just fine.. I just hadn't realized that I was typing everything in a html document, not a jsp page.


The initial problem still persists though.
I don't know how to put my ArrayList in a scope, and I don't know how to get it in the jsp.

Thanks
15 years ago
New question then..
useBean , as the name indicates, uses a bean. But how do I "get" the ArrayList into the jsp, through useBean? That should mean that I need to put the ArrayList in the bean, which sounds whacko to me. What am I missing..

Thanks for bearing with me,
Alia
15 years ago