试图从jsp调用一个类得到无法解决的错误

时间:2017-03-07 11:38:15

标签: java jsp

尝试从jsp调用mailer类而无法编译错误:

我的jsp看起来像:

<form action="books.jsp"  method="post">
  <%

    Mailer.send("abc@gmail.com","himagiri","abc@gmail.com","himagiri",password1);

    //change from, password and to      
%>

我的邮件程序如下

class Mailer{  
    public static void send(final String from,final String password,String      to,String sub,String otp){  
        //Get properties object    
        System.out.print("ghfgm");
        Properties props = new Properties();    
        props.put("mail.smtp.host", "smtp.gmail.com");    
        props.put("mail.smtp.socketFactory.port", "465");    

        //get Session   
        Session session = Session.getDefaultInstance(props,         
            new javax.mail.Authenticator() {    
                protected PasswordAuthentication getPasswordAuthentication() {    
                     return new PasswordAuthentication(from,password);  
                }    
            }
        );    
        //compose message                  
    }    
}

无法编译课程:

   org.apache.jasper.JasperException: Unable to compile class for JSP: 

  An error occurred at line: 36 in the jsp file: /otp.jsp
  Mailer cannot be resolved
 33:            }
 34:            String password1=new String(otp);

1 个答案:

答案 0 :(得分:0)

创建<ion-tabs> <ion-tab [root]="tab1Root" tabIcon="md-paper"></ion-tab> <!--<ion-tab [root]="tab1Root" tabIcon="md-paper" (ionSelect)="goToHome()"></ion-tab>--> <ion-tab [root]="tab2Root" tabIcon="md-apps"></ion-tab> <ion-tab *ngIf="selectedItem == 'true'" (ionSelect)="newBlog()" tabIcon="md-add-circle"></ion-tab> </ion-tabs> 类的对象,如

Mailer

试试这段代码,我认为它会起作用......