FileDocCategorySizeDatePackage
StoreMsgAction.javaAPI DocExample1764Tue Jun 08 11:26:42 BST 2004com.mycompany.messages

StoreMsgAction

public class StoreMsgAction extends Object
This class stores a new message in the Project Billboard application.
author
Hans Bergsten, Gefion software
version
1.0

Fields Summary
private NewsBean
newsBean
private EmployeeBean
validUser
private String
category
private String
msg
private String
requestMethod
Constructors Summary
Methods Summary
public java.lang.StringgetCategory()

	return category;
    
public java.lang.StringgetMsg()

	return msg;
    
public voidsetCategory(java.lang.String category)

	this.category = category;
    
public voidsetMsg(java.lang.String msg)

	this.msg = msg;
    
public voidsetNewsBean(NewsBean newsBean)

	this.newsBean = newsBean;
    
public voidsetRequestMethod(java.lang.String requestMethod)

	this.requestMethod = requestMethod;
    
public voidsetValidUser(EmployeeBean validUser)

	this.validUser = validUser;
    
public java.lang.Stringstore()
Creates a new NewsItemBean and sets its properties based on the "category" and "msg" request parameters, plus the firstName and lastName properties of the authenticated user (an EmployeeBean accessible as the "validUser" session attribute). The NewItemBean is then added to the NewsBean. This action is only performed for POST request.

        if ("POST".equals(requestMethod)) {
            NewsItemBean item = new NewsItemBean();
            item.setCategory(category);
            item.setMsg(msg);
            item.setPostedBy(validUser.getFirstName() + " " +
                validUser.getLastName());
            newsBean.setNewsItem(item);
        }
        return "success";