Welcome to my blog, hope you enjoy reading
RSS
Showing posts with label Struts. Show all posts
Showing posts with label Struts. Show all posts

Sunday, 23 February 2014

STRUTS : java.lang.IllegalAccessException

STRUTS : java.lang.IllegalAccessException

STRUTS : java.lang.IllegalAccessException: Class org.apache.struts.util.RequestUtils can not access a member of class view.myAction with modifiers "

Share

Tuesday, 1 October 2013

css class attributes inside of struts html tags

css class attributes inside of struts html tags

<html:text property="ssn" class="textfield2" />
this is not applying style

the following attribute is applying style
<html:text styleClass="textfield2"/>
Share

Thursday, 25 April 2013

How to get context-param from web.xml in struts app


How to get context-param from web.xml in struts app

The visibility of Context-param from web.xml is in servlet.In Struts the servlet is the ActionServlet. so in ActionServlet  class to get the context param values

example:

ServletContext cg=getServlet().getServletContext();

String driver = cg.getInitParameter("driver");

program:

package com.java.struts.Login;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.DynaValidatorForm;

public class UserLoginAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response)throws java.lang.Exception
{
String driver,url,user,pwd1;
DynaValidatorForm dform=(DynaValidatorForm) form;
HttpSession session=request.getSession(true);
String result="failed";
try
{
if(session!=null)
{
ServletContext cg=getServlet().getServletContext();
driver = cg.getInitParameter("driver");
url = cg.getInitParameter("url");
user = cg.getInitParameter("user");
pwd1 = cg.getInitParameter("password");
System.out.println(driver+" "+url+" "+user+" "+pwd1);
String username=dform.get("username").toString();
String pwd=dform.get("password").toString();
if(username!=null&&pwd!=null)
{
System.out.println(username+" "+pwd);
System.out.println("success");
}
}
}catch(Exception e)
{
System.out.println(e.toString());
}
return mapping.findForward(result);
}
}

Share

Thursday, 15 November 2012

Struts Plugin for Eclipse


Step 1: Go to Eclipse and from menu select Help->Install New Software.

Step 2: Add the following update site using 'Add' button

             http://download.jboss.org/jbosstools/updates/stable/indigo/ (for eclipse indigo)
                                      or
             http://download.jboss.org/jbosstools/updates/stable/helios/ (for eclipse helios)

Step 3: in eclipse select  File-->new-->Others-->JBoss Tools Web-->Struts-->StrutsProject.


Share