小编San*_*kar的帖子

如果当月是2月,如何获得下个月的开始日期和结束日期?

   String febSt = "02/01/2014" ;
   String febEnd = "02/28/2014" ;
Run Code Online (Sandbox Code Playgroud)

以上代码是我的输入我需要"03/01/2014"和"03/31/2014"作为输出.我尝试了更多代码并使用了日历功能,但没有结果.从这个程序我需要下个月的开始和结束日期.

    import java.text.DateFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.GregorianCalendar;

    public class MonthCalculation {


        public void getNextMonth(String date) throws ParseException{


            DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
            Date dt = format.parse(date);


            Date begining, end;

            {
                Calendar calendar = getCalendarForNow(dt);
                calendar.set(Calendar.DAY_OF_MONTH,calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
                setTimeToEndofDay(calendar);
                end = calendar.getTime();

                SimpleDateFormat endDt = new SimpleDateFormat("MM/dd/yyyy");
                String endStrDt = endDt.format(end);
                if(date != null && date.equalsIgnoreCase(endStrDt)){
                    System.out.println("Ending of the month");
                    calendar.add(Calendar.DAY_OF_MONTH, 1);
                    Date lastDate = calendar.getTime();
                    SimpleDateFormat …
Run Code Online (Sandbox Code Playgroud)

java date

4
推荐指数
2
解决办法
3万
查看次数

JSF 2.1(faces-config.xml)

我在eclipse(JUNO)中使用JSF2.1功能创建了一个动态Web项目,我按照下面链接中的所有步骤,http: //help.eclipse.org/helios/index.jsp?topic =%2Forg.eclipse.jst .jsf.doc.user%2Fhtml%2Fgettingstarted%2Ftutorial%2FJSFTools_tutorial_JSF20.html

我的问题是faces-config文件只有XML格式,但我没有得到"简介,概述,导航规则,托管bean,组件,其他和源"选项卡.在faces.config.xml文件中..

我怎样才能获得标签?

eclipse jsf jsf-2

1
推荐指数
1
解决办法
2048
查看次数

在java中从XML转换为JSON

XMLSerializer xmlSerializer = new XMLSerializer(); 
        JSON json  = xmlSerializer.read( xmlString );  
        System.out.println( json.toString(2) );


Exception in thread "main" java.lang.NoClassDefFoundError: nu/xom/Serializer
    at src.main.parser.main(parser.java:19)
Caused by: java.lang.ClassNotFoundException: nu.xom.Serializer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more
Run Code Online (Sandbox Code Playgroud)

虽然我从XML转换到Json我得到了这个错误......?

我怎么能解决这个问题.

谢谢Sankar

java xml json

1
推荐指数
1
解决办法
7141
查看次数

标签 统计

java ×2

date ×1

eclipse ×1

jsf ×1

jsf-2 ×1

json ×1

xml ×1