Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:09

using ; in an url (problem using menu with jsp and struts)


Poster: Johan_2003
Dated: Wednesday September 15 2004 - 13:06:30 BST

Hi,

I'm using jsp & struts to build my menu. I'm using url rewrite (html:rewrite) for building my url's. When my users are blocking cookies automaticly a session id is added to the url like this:
/iwt/algemeen/brochures.jsp;jsessionid=A6C2740FE57FAF195DE34027B96DA3AB?topNav=student

I allready posted a question about this some time ago and Andy replyed this:
"
Try enclosing the text inside backquotes like this:

aI("text=link;url=`/iwt/algemeen/brochures.jsp;jsessionid=A6C2740FE57FAF195DE34027B96DA3AB?topNav=student`);
"
but this doesn't always work.
The item isn't generated when the sessionid is NOT included when I use backquotes to enclose my URI.

The first time my users enter the site and click a link, the sessionid is appended to the URI. When the system is able to use cookies, there is no longer need for the sessionid and so it's no longer being appended. So, now my menu works only 1 time.

Try this example:
aI("url=`/iwt/algemeen/menu.jsp?topNav=toekomstig`;text=Algemene informatie;showmenu=algemeen;status=algemene informatie")

You'll see that this menu item isn't being generated.

I'm using milonic menu v5.47

Johan

struts, jsp, .do


Poster: rav4ski
Dated: Wednesday September 15 2004 - 15:23:52 BST

Hi,

I think I may be able to provide some help here.

As far as my Struts experience (I have used Struts for 4 clients.),
there is no need to put a JSP in your menu. (Except for the index.jsp.)

There should be actions with the someAction.do or /do/someAction as your menu URL.

All the JSP should be hidden inside of your struts-config.xml. And the session id will be handled by the Struts Frame work automatically. Therefore, you should not need to handle the session unless there is a reason to. (i.e. pass it to another web server).

All of the projects I had been working on with the combination of Struts and Milonic have not encountered any problem related to Struts. You may need to find out more details regarding how to use Struts from Jakarta web site or from Struts books.

If you still have question, you may need to post the question to Struts forum.


Poster: Johan_2003
Dated: Thursday September 16 2004 - 10:25:02 BST

Hello,

I suggest you reread my posting. It's struts which is doing the session handling and that's exactly where the problem is. The struts tag i'm using sometimes appends the session information, and sometimes it doesn't (when it's sure it can use session cookies it doesn't). It makes no difference if you refere to a action or a jsp.

You've probably never encountered problems because your menu isn't dynamically generated. Indeed there are no problems with using the combination Struts and the menu as such.
Thanks for the advice, but after developing struts for two years, it's almost getting clear to me how it works, i will skip the struts forum. :)

So, once more, where it all comes down too, the main question: my url sometimes contains a ; and sometimes it doesn't. How can I make sure the milonic menu handles this. Putting backquotes does the trick only when the ; is there, for some reason it doesn't work when you use backquotes and a url without a ;.

Thank in advance for the person who can help me out!
Johan


Poster: Andy
Dated: Thursday September 16 2004 - 10:43:42 BST

Hi,

Just to let you know that I've found a small bug when text is enclosed in back quotes but not semi-colon is found. This, I'm working on now and should have a fix later today.

In the mean time, the sample I gave before looks like it had the double quote in the wrong place, try this instead:

Code:
aI("text=link;url=`/iwt/algemeen/brochures.jsp;jsessionid=A6C2740FE57FAF195DE34027B96DA3AB?topNav=student`");


I'll let you know once I have something.

Cheers
Andy


Poster: Andy
Dated: Thursday September 16 2004 - 10:49:29 BST

Fix is done.

As soon as I've got all the other stuff and testing done the code will go up.

The new version will be 5.48, should be up in about 3 hours.

Cheers
Andy

Strus again


Poster: rav4ski
Dated: Thursday September 16 2004 - 13:42:56 BST

Sorry about this "Struts" design thing again.

If you take a look at Strus examples, the URL ususally is not "JSP" but ".do". That means, if you let the action servlet to control the forward then you won't see any JSP in your menu.

I am not saying you can't do that but I don't think that's the "MVC" design you want to go with when you are using Struts. Even if you are dealing with legacy JSP code, you can still move all the Java codes from your JSP into the Java (action or model) class, which is why you want to use Struts. Then you can debug all your Java codes in a Java IDE but not dealing with them inside the JSP. And at that point, you will only see "action.do" or "action.do?name1=aaa&name2=bbb" in your menu but not the session id. The ActionServlet will help you to deal with that.

I have done a lot this kind of conversion because I just can't stand to debug the Java codes insdie and of the JSP. It's wasting my life. (and my client's $$$ ;) ).

However, as I said, if you need to pass the session id to other web server, or if you want to allow one user to access another user's session :o :!: :?: , that may be still necessary.

Just my 2 cents.

Jason


Poster: Andy
Dated: Thursday September 16 2004 - 17:36:57 BST

Hi Guys,

Just posted version 5.48 to milonic.com

Sorry it took a little longer than originally planned, things are a bit hectic here at the moment

Cheers
Andy


Poster: Johan_2003
Dated: Friday September 17 2004 - 10:25:20 BST

It seems to me the problem is solved.

Thanks Andy!!


rav4ski, one last remark:

- disable cookies in your browser
- put this in your menu <html:rewrite page="/SomeAction.do" />

You will see it adds an session id.

This has nothing to do with design!

Of course struts handles the session, but when you visit a page for the first time, struts can't be sure it can put the session information on the client side.

Johan