Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Struts Struts2 Strutsresources Access Session

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

4 comments so far (post your own) View All Comments Latest 10 Comments:

Anna S is right. Look like there was a mistake in this example. There is no point to set the local variable to the class field for doing nothing!

Posted by Lan Tran on Monday, 04.28.08 @ 09:30am | #58033

This example is misleading as said in the previous post. The SessionAware documentation should be referenced and the author clearly did not understand what he was doing. Specifically, the session attribute defined in the Action is not used in the JSP. The JSP has it's own 'session' attribute that can always be accessed, even if nothing was done in the Action.

Posted by cedneve on Wednesday, 12.12.07 @ 15:30pm | #41936

If i overwrote my GetSession.java like below, it would provide d same result. So, what's d point of that class?
By the way, here is citation: 'Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult.'
http://struts.apache.org/2.0.9/struts2-core/apidocs/index.html
---------------------------------------------------
//GetSession.java
package net.roseindia;

import com.opensymphony.xwork2.ActionSupport;
import java.util.*;

public class GetSession extends ActionSupport{
public String execute() throws Exception{
return SUCCESS;
}
}

Posted by Viraszko on Monday, 08.27.07 @ 15:11pm | #24247

Just a second...
[code]
public void setSession(Map session){
session = this.getSession();
}
[/code/

Are you setting the method's local variable or the class field? Seems like the code should look like:

[code]
public void setSession(Map session){
this.session = session;
}
[/code/

Posted by Anna Skawińska on Monday, 08.13.07 @ 18:36pm | #23298

Ask programming questions?

 

 

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name

 

 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.