Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: struts2.0 action question

Don Brown

2006-12-13

Replies:

You need to create static field variables for those constants in your
Action class:

public static final String READ = "read";
public static final String WRITE = "write";

Don

On 12/13/06, red phoenix <rodphoenix@(protected):
> I am puzzled with struts2.0 action file,my files are follows:
>
> configure file is follows
> <action name="createRoom" class="crudRoomAction" method="create">
>   <result name="read">/chat/read.jsp</result>
>   <result name="write">/chat/write.jsp</result>
> </action>
>
> action file is follows:
> public String execute() throws Exception {
>   String flag=request.getParameter("flag");
>   if("1".equals(flag))
>    return SUCCESS;
>   else if("2".equals(flag))
>    return READ;
>   else
>    return WRITE;
> }
>
> when I compile my action file,it raise error,say READ and WRITE don't
> define.I am puzzled with it. Why SUCCESS is define,READ and WRITE don't
> define? I don't find anywhere to define SUCCESS! How to do it?
> if return SUCCESS,it will go to which page,read.jsp or write.jsp?
>
> Anyone could get rid of my puzzled?
>
> Thanks
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.