| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.whyc.pojo.UserInf; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import sun.misc.BASE64Decoder; |
| | |
| | | } |
| | | return lang; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @return 获取当前session 中的用户对象 |
| | | */ |
| | | public static UserInf getUser(){ |
| | | HttpSession session =getSession(); |
| | | Object obj=session.getAttribute("user"); |
| | | UserInf userInf = new UserInf(); |
| | | if(obj==null){ |
| | | userInf.setUname("未登录的用户账号"); |
| | | userInf.setUid(0); |
| | | }else{ |
| | | userInf=(UserInf) session.getAttribute("user"); |
| | | } |
| | | return userInf; |
| | | } |
| | | } |