Setting the URL in the Browser Address bar?

Can anyone tell me how I can set the address displayed in the browser address bar to what I want the user to see?

We have a single page that displays various reports within it and we'd like to put the report name in the browser address (for bookmarking and other reasons).

Can this be done? I read some ref info about changing the navigation method to "redirect" but that is not the answer for this.

Any help at all would be GREATLY appreciated!

Thanks,

<-j->

PS I tried to assign Duke Dollars but its failed again. Once I am able to, I will assgin some to this posting.

[620 byte] By [jarbus] at [2007-11-26 9:34:44]
# 1

Hi There,

Im not sure if I understand your question right. But in 1 page if you have different sections and you want the user to be able to bookmark each section separately, and you want a seperate link for each section?

What comes to my mind is HTML Anchors.

Im sure there are other solutions too.

Hope it helps

K

kish@sun at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks for your response, but no, that is not what I'm trying to do, although not THAT far off.

My app displays a selected report to the user on the page, lets call it MyUserDisplaypage.faces

I want to be able to set the url in the browser address bar to something like this:

MyUserDisplaypage/DailyReport08092006.html

so that the address is descriptive of what report is currently being displayed

AND

so that it can be bookmarked and then recalled -

by going to MyUserDisplaypage.faces and loading (for display) the

DailyReport08092006.html data report

I hope this makes it clear as to what I'm trying to do

and any assistance you could provide would be hugely appreciated!

Thanks again,

<-j->

BTW - I am STILL trying to resolve my inability to assign some Duke Dollars to this!

jarbus at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 3
Does this help? http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/boo kmarks.html
MrsJetsons at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 4
Thanks but no - that's no help for this.I mentioned in my original post reading about changing the navigation method to redirect - and that it really wouldn't work for me.This tutorial is where I read about this.Thanks again,<-j->
jarbus at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 5
Could you instead set your url like this?/faces/MyUserDisplaypage/DailyReport.jsp?report=08092006Are the reports generated on the fly or do you have a directory of a static set of reports?
jetsons at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 6

That might be a possibility, but how would I even do that?

My reports may be both: that is some may be generated on the fly from xml source and some may be from pre-existing html report dirs.

I guess the real question here is how to set the browser address bar to show what I want it to show?

jarbus at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 7

> Thanks for your response, but no, that is not what

> I'm trying to do, although not THAT far off.

>

> y app displays a selected report to the user on the

> page, lets call it MyUserDisplaypage.faces

>

> want to be able to set the url in the browser

> address bar to something like this:

>

> MyUserDisplaypage/DailyReport08092006.html

>

> so that the address is descriptive of what report is

> currently being displayed

> AND

> so that it can be bookmarked and then recalled -

>

> y going to MyUserDisplaypage.faces and loading (for

> display) the

> DailyReport08092006.html data report

>

You say you looked into redirecting, so I suppose putting something like the following in MyUserDisplaypage.faces is not what you want:

public String button1_action() {

try {

ExternalContext exContext = this.getExternalContext();

exContext.redirect("/MyUserDisplaypage/DailyReport08092006.html");

this.getFacesContext().responseComplete();

} catch (Exception e) {

error(e.toString());

}

return null;

}

>> Could you instead set your url like this?

>> /faces/MyUserDisplaypage/DailyReport.jsp?report=08092006

> That might be a possibility, but how would I even do that?

The bookmarkable URL tutorial that we mention above shows one way in the "Creating a Bookmarkable URL" section. The DailyReport.jsp would generate a report based on the parameter passed in, or perhaps redirect to one that already exists?

Am I getting any closer?

jetsons at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 8

Thanks. That just might work for me, but it would require me to switch to redirection, wouldn't it?

The thing is, when the user navigates to a new page, (or even just loading a new report into the same page), I need to execute a few things before leaving the current page.

If this could still be accomplished using redirection navigation than I suppose I might have to reconsider switching.

Can I still do what I need to do using redirection?

<-j->

jarbus at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...
# 9

If you still need to do some things before leaving the page, then in your button action method (or your hyperlink action method) do something like this, perhaps:

public String button1_action() {

... Do Your Stuff Here ...

try {

ExternalContext exContext = this.getExternalContext();

exContext.redirect("/MyUserDisplaypage/DailyReport08092006.html");

this.getFacesContext().responseComplete();

} catch (Exception e) {

error(e.toString());

}

return null;

}

jetsons at 2007-7-7 0:24:23 > top of Java-index,Development Tools,Java Tools...