我在托管bean中使用@SessionScoped
,它给了我错误。
@SessionScoped无法解析为类型
我错过了什么?
相关代码:
package javaeetutorial.guessnumber;
import java.io.Serializable;
import java.util.Random;
@Named
@SessionScoped
public class UserNumberBean implements Serializable {
// Do stuff.
}
答案 0 :(得分:2)
在下面添加导入
import javax.enterprise.context.RequestScoped;
将来您可以随时使用IDE来解决导入问题,在eclipse中使用ctrl + shift + o。
希望有所帮助。
答案 1 :(得分:-1)
改为添加Faces库:
with open('a.txt') as r: #open source file and assign it to variable r
r = r.read().split('@@@@@') #read the contents and break it into list of elements separated by '@@@@@'
new = [item.strip() for item in r if item] #clean empty rows from the list
for i, item in enumerate(new): #iterate trough new list and assign a number to each iteration starting with 0 (default)
with open('a%s.txt' % i+1, 'w') as w: #create new file for each element from the list that will be named 'a' + 'value of i + 1' + '.txt'
w.write(item) #writing contents of current element into file