Solved

Pop-up windows and struts

Posted on 2003-10-31
5
1,452 Views
Last Modified: 2013-11-28
This one is hard - for me! ;-)

In a struts-jsp application, is it possible to work with pop-up windows in this way (just an example):

In a calendar-userinterface you click on a date. A small "date-schedule-window" pops up, and you can change your schedule for that day in that window. On the same time, you can continue to navigate around in the original window. - So you can actually wait as long as you like before you alter the date-schedule, save it and then exit. Is this possible?? Yes?!? How??

This f...s up my mind completely, - normally with struts you navigate around between jsp's and Actionclasses, - but suddenly here the session gets "divided".

Any suggesitions?

Regards,

Nic
0
Comment
Question by:JNic
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9660364
>> Is this possible??
Yes!

>> How??
Just use another action class and another set of jsp page for popup winodw.

>> but suddenly here the session gets "divided".
session never gets divided, but rather the control flow is divided and that's OK.

Let me know if you have more specific question on this.
0
 
LVL 1

Author Comment

by:JNic
ID: 9660912
OH, this is interesting!

>>Let me know if you have more specific question on this.

OK:

Imagine this jsp (example!!):

<A HREF=date.do;jsessionid=<%=request.getSession().getId()%>?date=03041975>04/03/1975></A>

<FORM ACTION=scroll.do;jsessionid=<%=request.getSessoin().getId()%>
<input type="submit" value="scroll">
</FORM>

The link should bring you to the mentioned date-page, and the submit-button just illustrates "something else" you want to to do on the calendar page.
My question is then: How should the link look to make it a (small) pop-up sharing the same session?

Thanks,

Nic

P.S. The reason why I dont use tags to create the link is, that very often in my applications links have to be constructed from Java-generated HTML.
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 150 total points
ID: 9664767
first of all, you should never be encoding you own session url, it might work on one type of server, but not the other. the right approach is to use response.encodeURL().

there is a number of ways to popup a new windows, for example you can use target attribute of html <a> tag. If you want to control the size and style of the popup windows, you can use javascript.

Here is an simple raw example of how this should be done:
<A TARGET=calendar HREF='<%=response.encodeURL( "date.do?date=03041975" )%>' >04/03/1975></A>

A struts specific example:
<html:link target="calendar" action="actionName" paramId="date" paramName="yourbean", paramProperty="property">xxxx</html:link>
detail: http://jakarta.apache.org/struts/userGuide/struts-html.html#link

A JSTL example:
<c:url="date.do" var="myUrl">
      <c:param name="date" value="03041975"/>
</c:url>
<a target='calendar' href='<c:out value="${myUrl}"/>'>xxx</a>

0
 
LVL 1

Author Comment

by:JNic
ID: 9665551
I will quote myself from another thread: Kenneth, "it is SO nice to have you back!"

THANK YOU for your always very detailed and good answers!

Kindest regards,

Nicolai  
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9665855
It's my pleasure and glad to know your problem is solved :-)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
if statement not resolving in my code 5 52
Talking avitars 11 144
maven project jars 7 53
I get error: useBean: Duplicate bean name: {0} 1 138
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question